编写自定义函数把一个字符串(不超80字符)的内容复制到另一个字符数组中。主函数输入一串字符,复制到另一个数组中输出。
#includeint str_copy(char *d,char *s){ //请在此输入你的代码 } int main(){ char pa[81]; char pb[81]; gets(pa); str_copy(pb,pa); printf("%s",pb); return 0; }
输入输出示例
| 输入 | 输出 | |
| 示例 1 | #include | #include |
#includeint str_copy(char *d,char *s){ while(*s!=' ') { *d=*s; *s++; *d++; } *d=' '; } int main(){ char pa[81]; char pb[81]; gets(pa); str_copy(pb,pa); printf("%s",pb); return 0; }



