strcpy(destination,source)函數(shù)將源字符串(source)復(fù)制到目的(destination)字符串中。
使用示例
創(chuàng)建一個源文件:string_strcpy.c,其代碼如下所示 -
#include <stdio.h>
void main()
{
char ch[20] = { 'y', 'i', 'i', 'b', 'a', 'i', '.', 'c', 'o', 'm', '\0' };
char ch2[20];
strcpy(ch2, ch);
printf("Value of second string is: %s \n", ch2);
}
執(zhí)行上面示例代碼,得到以下結(jié)果 -
Value of second string is: yiibai.com