自己写一个函数,将2个字符串连接。(不能用strcat()函数)
1 回答
望远
TA贡献1017条经验 获得超1032个赞
#include<stdio.h>
void main()
{
char str1[50]="I am";
char str2[20]=" a studnet";
int i,j;
for(i=0;str1[i]!='\0';i++);
for(j=0;str2[j]!='\0';j++)
{
str1[i++]=str2[j];
}
str1[i]='\0';
puts(str1);
}
- 1 回答
- 0 关注
- 1471 浏览
添加回答
举报
0/150
提交
取消
