Skip to content

Instantly share code, notes, and snippets.

@AkhandMishratruth
Last active July 31, 2018 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkhandMishratruth/e26ed367225dc18f951184fb8d392bfc to your computer and use it in GitHub Desktop.
Save AkhandMishratruth/e26ed367225dc18f951184fb8d392bfc to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <signal.h>
void handler(int signal_number){
printf("Interrupt occured, Ctrl + C is pressed\n");
}
int main(){
signal(SIGINT, handler);
while(1){
sleep(1);
printf("Waiting for interrupt\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment