编一程序,将两个字符串连接起来,不要用strcat函数


#include <stdio.h>
int main()
{
    char s1[80],s2[40];
    int i=0,j=0;
    printf("Please input your String1:\n");
    scanf("%s",s1);
    printf("Please input your String2:\n");
    scanf("%s",s2);
    while(s1[i]!='\0')
    i++;
    while(s2[j]!='\0')
    {
        s1[i]=s2[j];
        j++;
        i++;
    }
//    s1[i]='\0';
    printf("The new string is:%s\n",s1);
    return 0;
    
    
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM