#include #include #include int global; int main() { if (fork()) { /* only the 1st parent enters here */ fork(); /* ...to fork() a 2nd child... */ } /* All 3 processes (parent and children) run the following */ global = getpid(); /* set to a process-specific value */ sleep(1); printf("PID is %d, global = %d\n", getpid(), global); }