我不明白以下代码为什么会这样工作。我的意思是,它并没有在每个一秒的延迟后打印“hello”...而是等待了5秒并一次性显示了
hellohellohellohellohello
。#include <stdio.h>
int i;
for(i=0; i<5; i++) {
printf("hello");
sleep(1);
}
main
函数中包含代码... 你真的编译并执行了吗? - Jay