#include<stdio.h> int main(void){ char ch[500]; scanf("%s", ch); int j = 0; printf("%s", ch); } 运行结果: hellow is a hellow Why scanf在遇到空格时会停止扫描,所以只能读入前半部分,后面的 How to solve it 用gets()替换scanf处理字符串