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

用c语言编写程序,将两个字符串连接起来,不要用strcat函数编写一程序,将两个字符串连接起来。不要用strcat函数。请完成strc函数的功能。
#include <stdio.h>
#include <string.h>
void strc(char c1[],char c2[]);
void main()
{
char s1[30]="abc";
char s2[30]="def";
strc(s1,s2); //请在后面补充strc函数的功能,完成两个字符串的连接
puts(s1);

}
void strc(char c1[],char c2[])
{
//请填空,完成两个字符串的连接
}

#include <stdio.h>
#include <string.h>
void strc(char c1[],char c2[]);
void main()
{
char s1[30]="abc";
char s2[30]="def";
strc(s1,s2); //请在后面补充strc函数的功能,完成两个字符串的连接
puts(s1);

}
void strc(char c1[],char c2[])
{
    //请填空,完成两个字符串的连接
    int i,j;
    for(i = 0; c1[i]; i ++);
    
    for(j = 0; c2[j]; j ++)
        c1[i+j] = c2[j];
    c1[i+j] = 0;
}
温馨提示:答案为网友推荐,仅供参考