首页 › 答案 › 题库 › 远程教育 › 联大学堂

以下是将两个字符串连接起来的程序,请填空完成。

以下是将两个字符串连接起来的程序,请填空完成。
main()
{ char s1[80],s2[40];
int i=0,j=0;
printf("\nInput string1:"); scanf("%s",s1);
printf("\nInput string2:"); scanf("%s",s2);
while(s1[i]!='\0')
();
while(s2[j]!='\0')
();
s1[i]='\0';
printf("The new string is %s\n",s1);
}
正确答案:(1) i++; (2) s1[i++]=s2[j++];