#include <signal.h>
#include <stdio.h>

void hello(int signum){
  printf("Hello world!\n");
}

int main(){
  //Handle SIGINT with hello
  signal(SIGINT, hello);

  while (1) {
      // ...
  }
}