title: Handle signals in ncurses
body: <p>I am writing a program in C using ncurses.I am trying to handle the CRTL C signal. In my code, this signal is being caught and dealt with but the program is not termination correctly. Could it be the way I am exiting from ncurses?</p>
  
  <pre><code>//handle SIGINT signal
  void handle_signal(int signal){
  
     if(signal == SIGINT){
  
        clear();
        mvprintw(3,3,"A SIGNAL WAS ENCOUNTERED");
        refresh();
        sleep(1/2);
        exit(0);
  
      } //close if statement 
  
  }//close handle_signal() function
  </code></pre>