Why does my output only print if there is another print after it?

后端 未结 3 879
[愿得一人]
[愿得一人] 2020-12-22 01:57

Interesting little bug here:

if (host != NULL) {
    printf("hi");
} else {
    printf("FAIL");
}
return 0;

doesn\'t prin

3条回答
  •  萌比男神i
    2020-12-22 02:09

    The difference is the \n characters.

    As you printf characters, they are accumulated in a buffer which isn't sent to the output device until an 'end of line' character is sent.

提交回复
热议问题