7.13编写一程序将两个字符串连接起来,不使用stracat函数

7.13编写一程序将两个字符串连接起来,不使用stracat函数

输入的时候,注意字符串的长度。

#include<stdio.h>//7.13 编写一个程序,将两个字符串连接起来,不要用strcat函数。  
int main()  
{  
    char c1[20],c2[20];  
    int i=0,j=0;  
    printf("Input string1:");  
    gets(c1);  
    printf("Input string2:");  
    gets(c2);  
    while(c1[i]!=''){
        i++;
    }
    while(c2[j]!=''){
        c1[i++]=c2[j++];
    }  
    c1[i]='';  //给出c1字符串的结束符,此时,c1和c2的长度和可以是20
    puts(c1);  
    return 0;  
原文地址:https://www.cnblogs.com/Allen-win/p/7221540.html