Can someone explain how this code works?
int main() { printf("Hello"); fork(); printf("World"); }
Fingerprints:
HelloWorldHelloWorld
My exact question is: why hello prints twice. Isn't hello printed first, then fork() is executed?
In addition, sometimes he prints:
HelloWorld // then the reports....process exited with return value 0..etc etc.. then...// HelloWorld
Why is this conclusion?
c fork
guitar_geek
source share