String copy

String copy in C Programming

#include
#include
int  main()
{
char str1[15]=”String A”;
char str2[15]=”String B”;
clrscr();
printf(“\n\nBEFORE:\n\nstr1 : %s\t\t\tstr2 : %s\n\n”,str1,str2);
strcpy(str1,str2);
printf(“\n\nAFTER:\n\nstr1 : %s\t\tstr2 : %s\n\n”,str1,str2);
getch();
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *