用scanf获取一行包括空格的字符串,并指定以特定输入结束读入 #include<stdio.h> int main() { char a[777]; scanf("%[^\n]",&a); printf("%s",a); return 0; } 以换行符为读入字符串的终了标志