To better understand how processes work, 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 was
411
This was not quite what I expected.
- how much is the value variable worth?
- What is certainly happening?