小编ak4*_*k44的帖子

睡在里面循环

我无法理解为什么下面的代码会像这样工作..我的意思是:在每一秒延迟后不再打印"你好"......它会等待5秒并立即显示hellohellohellohellohello.

#include <stdio.h>

int i;
for(i=0; i<5; i++) {
   printf("hello");
   sleep(1);
}       
Run Code Online (Sandbox Code Playgroud)

c linux sleep

2
推荐指数
1
解决办法
5388
查看次数

标签 统计

c ×1

linux ×1

sleep ×1