#include #include int main(void) { // Child will get idential COPY of this variable int x = 7; // fork creates 2 identical copies of program // only return value is different pid_t pid = fork(); if (pid == -1) { perror("fork"); // print why the fork failed } else if (pid == 0) { printf("Child x was %d\n", x); x = 99; printf("Child x is %d\n", x); } else { printf("Parent x was %d\n", x); x = x/2; printf("Parent x is %d\n", x); } return 0; }