I want the program to test the trapping of the signal by typing CTRL+C to generate a signal of type SIGINT. I don't know, my program just counts to the first interrupt signal and ends the program (just jumps straight into the INThandler function)
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <time.h>
void signalHandler( int signalValue ); /* prototype */
void  INThandler(int signalValue);
int main( void )
{
 int i; /* counter used to loop 100 times */
 int x; /* variable to hold random values between 1-50 */
 signal( SIGUSR1, signalHandler ); 
 signal(SIGUSR1, INThandler);
 srand( time( NULL ) );
    for ( i = 1; i <= 100; i++ ) {
        x = 1 + rand() % 50;
        if ( x == 25 ) {
            raise( SIGUSR1 );
        } 
        printf( "%4d", i );
        if ( i % 10 == 0 ) {
            printf( "\n" );
        } 
    }
  return 0; 
} 
void signalHandler( int signalValue )
{
  int response; 
  printf( "%s%d%s\n%s","\nInterrupt signal ( ", signalValue, " ) received.",
                     "Do you wish to continue ( 1 = yes or 2 = no )? \n" );
   scanf("%d", &response);
    if ( response == 1 ) {
        signal( SIGINT, signalHandler );
    }
    else {
    signal(SIGINT, INThandler);
    } 
}
void  INThandler(int signalValue)
{
  signal(signalValue, SIG_IGN);
  printf("\nCtrl-C command detected!");
  exit(0);
}
 
    