Question: int x = 5; void handler(int sig) { x += 3; fprintf(stderr, inside %d , x); } int main() { fprintf(stderr, start ); // POSITION
int x = 5; void handler(int sig) { x += 3; fprintf(stderr, "inside %d ", x); } int main() { fprintf(stderr, "start "); // POSITION A struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT,&act,NULL); // POSITION B x += 2; // POSITION C fprintf(stderr, "outside %d", x); return 0; } What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position C?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
