二つの文字列が接続され、strcatのが機能しません。

#include<stdio.h>
int main()
{
    char s1[80],s2[40],i=0,j=0;
    scanf("%s",s1); //不能加\n
    scanf("%s",s2); //不能加\n
    while(s1[i]!='\0')
        i++;
    while(s2[j]!='\0')
     {s1[i++]=s2[j++];}
    s1[i]='\0';
    printf("%s\n",s1);
    return 0;
}

公開された87元の記事 ウォン称賛24 ビュー40000 +

おすすめ

転載: blog.csdn.net/zhangxue1232/article/details/104836061