功能:複製字串
/* strcpy example */
#include <stdio.h>
#include <string.h>
int main ()
{
char str1[] = "Sample string";
char str2[40];
char str3[40];
strcpy (str2, str1);
strcpy (str3, "copy successful");
printf ("str1: %s\n str2: %s\n str3: %s\n", str1, str2, str3);
return 0;
}
參考出處:
http://www.cplusplus.com/reference/cstring/strcpy/?kw=strcpy
沒有留言:
張貼留言