#include <stdio.h>
main()
{
char a[100],b[100];
int i=0,j=0;
printf("Please input 2 strings:\n");
gets(a); //输入字符串啊,a,b
gets(b);
while(a[i]!='\0')
i++; // i 表示字符串a的'\0'所在的位置
while(b[j]!='\0') //将b中字符一个个赋值给'\0'以及其后面的位置,i++,j++控制一一对应
a[i++]=b[j++];
a[i]='\0' //给一个结束标志
puts(a); //输出
return 0;
}
C语言,连接2个字符串,不用strcat
最新推荐文章于 2024-06-17 09:00:00 发布