If the call to fork() is executed successfully, Unix will make two identical copies of address spaces, one for the parent and the other for the child. Both processes will start their execution at the next statement following the fork() call.[Ref:http://www.csl.mtu.edu/cs4411.ck/www/NOTES/process/fork/create.html].
So,if I execute the following code:
#include <stdio.h>
int main(void)
{
printf("Hello\n");
fork();
printf("World\n");
return 0;
}
I think it will print
Hello
World
World
But when I run the program it prints
Hello
World
Hello
World
Please explain where am I lacking in concept?