I was just reading an article online about fork().According to what I get,the fork() system call creates a subprocess and the program counter is updated to the next instruction and the control is passed on to the child process and then control comes back to the parent process.On exectuting the following program:
I expected the output to be :
0 positive value
since the successful call to fork() returns 0 to the child process and process ID of child to parent,and child will run first after the call to fork(),but I was amazed to find the output as:
positive value 0
Where am I going wrong?