On this C program I get output I can't understand.
#include <stdio.h>
int main()
{
printf("Hello World\n");
printf("%d\n", fork());
return 0;
}
It outputs:
Hello World
5
Hello World
0
My question, is why does it print "Hello World" twice? From my understanding it would print "Hello World" then call fork().
Does fork() start from the beginning of the program?