注:不能使用scanf("%s", p);
的方式输入,可以使用gets(p);
来输入。
#include<stdio.h>
int main()
{
char q[20];
gets(q); //输入hello world
printf("%s", q); //输出hello
return 0;
}
#include<stdio.h>
int main()
{
char p[20];
scanf("%s", p); //输入hello world
printf("%s", p); //输出hello world
return 0;
}