C program to copy one string to another string using strcpy() function.












C program to copy one string to another string using strcpy() function.




C program to copy one string to another string using strcpy() function.



#include <stdio.h> #include <string.h> #define MAX 100 int main() { char text1[MAX], text2[MAX]; printf("\n Enter any string: "); gets(text1); strcpy(text2, text1); printf("\n First string = %s", text1); printf("\n Second string or copy string = %s", text2); return 0; }


Output:
Enter any string: c string program First string = c string program Second string or copy string = c string program




Exercise: 1
C program to copy one string to another string.