How to copy a C string

#include <stdio.h>
int main (void)
{
    char s1[100];
    char s2[100];
    gets(s1);
    gets(s2);
    strcpy(s1,s2); //copy s2 to s1
    printf("s1= %s s2= %s\n",s1,s2);
    system("pause");
    return 0;
}
    

0 comments:

Post a Comment