题目:编写程序,将两个字符串连接起来,不能用 strcat 函数。
#include<stdio.h>
#include<string.h>
int main()
{
char s1[100], s2[100];
int i = 0, j = 0;
printf("input two strings:\n");
gets_s(s1);
gets_s(s2);
while (s1[i] != '\0')
{
i++;
}
for (j; s2[j] != '\0'; j++)
{
s1[i++] = s2[j];
}
s1[i] = '\0';
printf("The new string is:%s\n", s1);
return 0;
}