为什么为scanf输入放置多个句点会跳过下一个scanf函数。示例输入:b. b.
int main (void) {
char b[7] = " ";
printf("This is: ");
scanf(" %s", b);
printf("This is 2nd: ");
scanf(" %s", b);
printf("This is 3rd: ");
scanf(" %s", b);
printf("\nThis is 4rth: %s\n", b);
printf("This is 5th: %s", b);
return 0;
}
//输出
This is: b. b.
This is 2nd: This is 3rd:
不是句号的问题,跳过下一个scanf
语句是因为您的输入包含空格。