功能:用函数将第2个串连接到第1个串之后,不允许使用s

功能:用函数将第2个串连接到第1个串之后,不允许使用strcat函数。

#include<stdio.h>
void len_cat(char c1[],char c2[])
{
    int i,j;
    for(_____1_____);
    for(_____2_____)
    {
        _____3_____
    }
    _____4_____
}
void main()
{
    char s1[80],s2[40];
    void TestFunc();
    gets(s1);gets(s2);
    len_cat(s1,s2);
    printf("string is: %s\n",s1);
    TestFunc();
}
void TestFunc()
{
    FILE *IN,*OUT;
    int m,n;
    int i[2][200];
    IN=fopen("in.dat","r");
    if(IN==NULL)
    {
        printf("Read File Error");
    }
    OUT=fopen("out.dat","w");
    if(OUT==NULL)
    {
        printf("Write File Error");
    }
    for(n=0;n<2;n++)
        fscanf(IN,"%s",i[n]);
    len_cat(i[0],i[1]);
    fprintf(OUT,"%s\n",i[0]);
    fclose(IN);
    fclose(OUT);
}
答案
第1空:i=0;c1[i]!='\0';i++
第2空:j=0;c2[j]!='\0';j++
第3空:c1[i+j]=c2[j];
第4空:c1[i+j]='\0';

题目信息

题号:6739
题型:填空题
难度:普通