main.cc: In function `int main()': main.cc:31: error: `status' declared as reference but not initialized ---- #include #include #include #include // prototype static void sig_handler(int); int main() { int i; int parent_pid; int child_pid; int status; if( signal(SIGHUP, sig_handler) == SIG_ERR) printf("Parent: Unable to create handler for SIGHUP\n"); // Getting the parents process id parent_pid = getpid(); // Spawn the child process and get the process id. if ((child_pid = fork()) == 0) { printf("Child: This is the child --> %d \n", child_pid); printf("Child: Sending SIGHUP to parent \n"); kill(parent_pid, SIGHUP); exit(0); } else { printf("Parent: Waiting for child to exit\n"); wait(&status); printf("Parent: Process completed\n"); } } // Signal Handler static void sig_handler(int signo) { printf("Signal is recieved!"); switch (signo) { case SIGHUP: /* Incoming signal is SIGHUP signal */ printf("---> SIGHUP recieved"); break; } return; }