Why is the line following printf(), a call to sleep(), executed before anything is printed?
问题 I thought I was doing something simple here, but C decided to go asynchronous on me. I'm not sure what's going on. Here's my code: #include <stdio.h> int main() { printf("start"); sleep(5); printf("stop"); } When I compile and run, I notice that sleep(5) works like a charm. But the compiler decided it was a good idea to skip the first printf() and go out of order, so when running, the program waits for 5 seconds and then prints startstop . What's the deal? My theory is that the program