[C语言] 不用strcat()函数,将两个字符串连接起来,试完善一下程序!

[C语言] 不用strcat()函数,将两个字符串连接起来,试完善一下程序!#include<stdio.h>
#include<string.h>
int main()
{ char s1[80],s2[40];
int i=0,j=0;
printf("Enter s1:");
scanf("%s",s1);
printf("Enter s2:");
scanf("%s",s2);

(.............)

printf("\nResult is:%s",s1);
getch();
return 0;
}

#include<stdio.h>

int main()

{ char s1[80],s2[40];

int i,j;

printf("Enter s1:");

scanf("%s",s1);

printf("Enter s2:");

scanf("%s",s2);

for(i=0;s1[i];i++);

for(j=0;s1[i++]=s2[j++];);

printf("\nResult is:%s",s1);

getch();

return 0;

}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-06-03
从第1个字符串后面,添加第2个字符串

~
~
~追问

能写一下代码吗?

第2个回答  2017-06-03
从第1个字符串后面,添加第2个字符串

~
~
~追问

能写一下代码吗?

相似回答
大家正在搜