strcpy(destination,source)函数将源字符串复制到目的地。
#include<stdio.h>#include<string.h> int main(){ char ch[20]={'l', 'e', 'a', 'r', 'n', 'f', 'k', '\0'}; char ch2[20]; strcpy(ch2,ch); printf("Value of second string is: %s",ch2); return 0; }
输出:
链接:https://www.learnfk.comhttps://www.learnfk.com/c-programming/c-strcpy.html
来源:LearnFk无涯教程网
Value of second string is: learnfk
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)