Unix signals doubt - on the execution of the below progem
问题 I have this below program #include <signal.h> #include <stdio.h> #include <unistd.h> int x = 1; void ouch(int sig) { printf("OUCH! dividing by zero!\n"); x = 0; } void fpe(int sig) { printf("FPE! I got a signal: %d\n",sig); psignal(sig, "psignal"); x = 1; } int main(void) { (void) signal(SIGINT, ouch); (void) signal(SIGFPE, fpe); while(1) { printf("Hello World: %d\n",1/x); sleep(1); } } Problem: While executing this program - when I give a SIGINT from the terminal to the program - the ""OUCH!