Why does printf() not print anything before sleep()?
问题 I'm just learning C with Kernighan and Ritchie's book; I'm in the basics of the fourth chapter (functions stuff). The other day I became curious about the sleep() function, so tried to use it like this: #include <stdio.h> #include <unistd.h> int main(void) { printf(" I like cows."); sleep(5); return 0; } The problem is the output of the program, it looks like it does the sleep() first and then the printf() , in other words, it waits five seconds and then prints the string. So I thought, maybe