char *strcpy(char *str1 , const char *str2 );
Copies the string pointed to by str2 to str1.
Copies up to and including the null character of str2. If str1 and str2 overlap the behavior is undefined.
char * strcpy ( char * destination, const char * source );
This function has the following parameter.
destination is returned.
#include <stdio.h>
#include <string.h>
/*ww w . j a v a 2 s . c om*/
int main (){
char str1[]="this is a test";
char str2[40];
char str3[40];
strcpy (str2,str1);
strcpy (str3,"copy successful");
printf ("str1: %s\nstr2: %s\nstr3: %s\n",str1,str2,str3);
return 0;
}
The code above generates the following result.