gpt4 book ai didi

c - "printf"不立即打印字符串

转载 作者:太空狗 更新时间:2023-10-29 15:49:08 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Why does printf not flush after the call unless a newline is in the format string? (in C)

我有这样的代码:

printf("Starting nets allocation...");
while(...)
{
...some operations...
}
puts("DONE");

代码应立即打印字符串“Starting nets allocation...”,然后在循环后打印“DONE”。

相反,程序首先执行循环,然后打印字符串“Starting nets allocation...DONE”为什么会这样?我该如何解决这个问题?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com