C语言strcpy()函数
作者:--
发布时间:2019-11-20
评论:0
阅读:0
strcpy(destination,source)函数将源字符串(source)复制到目的(destination)字符串中。
使用示例
创建一个源文件: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);
}
执行上面示例代码,得到以下结果 -
value of second string is: h3.com