#include // wait #include // pid_t #include // printf #include // getpid, getppid, fork int main(int argc, char* argv[]) { printf("%d\n", getpid()); pid_t f = fork(); printf("%d %d\n", f, getpid()); if (f == 0) { // in child printf("Parent: %d\n", getppid()); } else { int status; wait(&status); printf("Child exit status: %d\n", status); } }