Why would C get stuck halfway through a while loop?

喜欢而已 提交于 2019-12-05 02:47:15

Output usually is buffered and only written after a flush or newline. In

printf("sanity check");

there is no newline, so if you run in an endless loop after this, you won't see it. Replace it with

printf("sanity check\n");

or

printf("sanity check");
fflush(stdout);

and you'll see it.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!