将两个字符连接起来,不能使用strcat函数

#include<stdio.h>

int strcat(char c[100],char d[100])

{

    int i,j;

    puts(c);

    puts(d);

    for(i=0;c[i]!='\0';i++);

    for(j=0;d[j]!='\0';j++)

    {   

        c[i++]=d[j];

    }

    c[i]='\0';

    puts(c);

    return c;

}

int main()

{

    char a[100];

    char b[100];

    gets(a);

    gets(b);

    strcat(a,b);

     return 0;

}

猜你喜欢

转载自blog.csdn.net/qq_42164474/article/details/80302279
今日推荐