#include #include #include int main(int argc, char *argv[]) { pid_t pid; switch (pid = fork()) { case -1: { perror("fork"); _exit(EXIT_FAILURE); } case 0: { printf("I'm the child. My pid is %u\n", getpid()); _exit(EXIT_SUCCESS); } default: { printf("I'm the parent. My pid is %u, my child's pid is %u\n", getpid(), pid); } } return 0; }