Article 5DTB1 Why is my signal not handled ?

Why is my signal not handled ?

by
barunparichha
from LinuxQuestions.org on (#5DTB1)
Code:#include<stdio.h>
#include<stdlib.h>
#include<signal.h>
#include<unistd.h>

void handle(int sig)
{
printf("caught");
}

int main()
{
signal(SIGINT, handle);
while(1){
sleep(5);
}
return 0;
}How am i sending signal ?
kill -2 pid
or
ctrl +C (on terminal)latest?d=yIl2AUoC8zA latest?i=fobbT1t1tQo:vn7efMNcLxU:F7zBnMy latest?i=fobbT1t1tQo:vn7efMNcLxU:V_sGLiP latest?d=qj6IDK7rITs latest?i=fobbT1t1tQo:vn7efMNcLxU:gIN9vFwfobbT1t1tQo
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments