Copy one string to another string with C.
#include <stdio.h>
#include <string.h>
int main()
{
char text1[100], text2[100];
/* Input original string from user */
printf("Enter any string: ");
gets(text1);
/* Copy text1 to text2 using strcpy() */
strcpy(text2, text1);
printf("First string = %s\n", text1);
printf("Second string = %s\n", text2);
return 0;
}
Output
Enter any string : Rezaul Karim
First string = Rezaul Karim
Second string = Rezaul Karim
0 Comments