為什么這樣提交顯示錯誤?編輯器可以運行啊
#include <stdio.h>
#include <string.h>
int main()
{
? ? char s1[100]="";
? ? char s2[]="我愛,";
? ? char s3[]="慕課網";
? ? /*在以下補全代碼*/
? ? strcat(s1,strcat(s2,s3));
? ??
? ? printf("%s\n",s1);
? ? return 0; ? ?
}
求大神解答
#include <stdio.h>
#include <string.h>
int main()
{
? ? char s1[100]="";
? ? char s2[]="我愛,";
? ? char s3[]="慕課網";
? ? /*在以下補全代碼*/
? ? strcat(s1,strcat(s2,s3));
? ??
? ? printf("%s\n",s1);
? ? return 0; ? ?
}
求大神解答
2016-10-27
舉報
2016-10-27
發現問題了沒有? s1里有個空格 所以用strcpy(s1,s2)把空格覆蓋掉 然后再strcat拼接
2016-10-28
我知道答案上是對的 ? ?可是我這樣寫不對嗎?
2016-10-27
#include <stdio.h>
#include <string.h>
int main()
{
??? char s1[100]="";
??? char s2[]="我愛,";
??? char s3[]="慕課網";
??? /*在以下補全代碼*/
??? strcpy(s1,s2);
?? strcat(s1,s3);
???
??? printf("%s\n",s1);
??? return 0;???
}