Strcpy in c

strcpy() function copies one string to other. Here the main point is the destination string size should be greater than size of the source string. If there are any characters in destination string those will be deleted and source string characters will be replaced.

syntax:

strcpy(s1,s2);

here 2nd string is copied into first-string.so while using printf function we should choose first string for the output.

example:

#include
#include
#include
int main()
{
char s1[30]="codeskulls";
char s2[30]="website";
printf("Before coping :");
printf("\n str1 : %s \n str2: %s \n\n",s1,s2);
strcpy(s1,s2);
printf( "\nafter coping) = %s",s1);
}