The two strings are connected, do not function 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;
}

Published 87 original articles · won praise 24 · views 40000 +

Guess you like

Origin blog.csdn.net/zhangxue1232/article/details/104836061