I have this program in C++ that forks two new processes:
#include
#include
#include
#include
This is called "virtual address". Each process has its own address space, and each address means something different, depending on the process. fork() creates a copy, instead of sharing data (technically, they may get shared copy-on-write, but this is has the same effect as upfront copying would). IOW, the variable "shared" is not shared between processes.