The following example from The Programming Linux Programming Interface by Michael Kerrisk

```
static void sigHandler(int sig){
    printf("Ouch!\n");
}

int main(int argc, char *argv[])
{
    int j;

    if (signal(SIGINT, sigHandler) == SIG_ERR)
    errExit("signal");

    for (j = 0; ; j++){
        printf("%d\n", j);
        sleep(3);
    }
}

```

is supposed print "Ouch!" to the terminal whenever the user types Control-C (CTRL+C); in the author's own example, he types it twice before finally quitting the terminal with Control-\ (CTRL+\ ).

When I do this, the program works as expected on *only* the first execution of CTRL+C. If I type it in for the second time, like the author does in his example, my program quits the terminal- it does not print "Ouch!" nor does it continue to run (looping). 

I used the exact same code as given here, on the book's website:

[Ouch.c](http://man7.org/tlpi/code/online/book/signals/ouch.c.html "Ouch.c")