%s格式输入,一旦遇到空格,换行就表示结束了,所以只能输出hello,如果中间没有空格就会输出helloworld
可以用单循环加scanf函数替换%s。for(i=0;i<80;i++){ scanf("%c",str1[i]); if(str1[i]=='\n') break;}