C语言 紧跟printf之后的while(1)

当 printf() 后面紧跟 while(1) 时,printf的内容有时候能打印出来,有时候打印不出来

原因是,printf() 中的内容在缓冲区里,你得加上 ‘\n’ 或者使用 fflush(stdout) 才能让它打印出来。

答案来源:https://stackoverflow.com/questions/42649873/printf-not-executing-before-the-while1-loop-in-c-language-in-linux

posted @ 2022-08-29 22:51  yinhuachen  阅读(50)  评论(0编辑  收藏  举报