The following program shows how to use the signal system call to establish a signal handler for a signal (here, the SIGINT signal, which corresponds to typing CTRL-C at the terminal).