-6
To better understand the workings of the processes, Fork, I wrote this test program:
#include <unistd.h>
#include <stdio.h>
int main(){
int value = 9 ;
int pid = fork();
if(pid==0) value+=2 ;
else value-=5 ;
printf("%d",value);
}
The output obtained was
411
Not quite what I expected.
- after all how much is worth the value variable?
- what is happening for sure?