/*-------------------------------------------------------------------*/ /* testfork.c */ /* The fork system call. */ /*-------------------------------------------------------------------*/ #include #include int main(int argc, char *argv[]) { printf("Parent process (%ld)\n", (long)getpid()); fflush(stdout); fork(); printf("Parent and child processes (%ld)\n", (long)getpid()); fflush(stdout); return 0; } /* Sample executions: --> gcc -Wall -ansi -pedantic -o testfork testfork.c --> testfork Parent process (99) Parent and child processes (99) Parent and child processes (100) --> testfork Parent process (112) Parent and child processes (112) Parent and child processes (113) --> */