为什么scanf()会在这段代码中导致无限循环?
#include <stdio.h>int main(){ int number, p = 0, n = 0; while (1) { printf("-> "); if (scanf("%d", &number) == 0) { printf("Err...\n"); continue; } if (number > 0) p++; else if (number < 0) n++; else break; /* 0 given */ } printf("Read %d positive and %d negative numbers\n", p, n); return 0;}
PIPIONE
牛魔王的故事