Tag: terminal

为什么程序不执行最终的printf语句?

我无法弄清楚为什么程序控制没有到达第三个printf,就在for循环之后。 为什么不打印第三张printf ? 如果我将for循环更改为while循环,它仍然不会打印。 这是程序和输出: main() { double nc; printf (“Why does this work, nc = %f\n”, nc); for (nc = 0; getchar() != EOF; ++nc) { printf (“%.0f\n”, nc); } printf (“Why does this work, nc = %f”, nc); } 输出是: Why does this work, nc = 0.000000 test 0 1 2 3 4