⟩ What will happen if we press "Ctrl+c" key two times after running this program? #include<stdio.h> #include<signal.h> void response(int); void response(int sig_no) { printf("Linuxn"); signal(SIGINT,SIG_DFL); } int main() { signal(SIGINT,response); while(1){ printf("googlen"); sleep(1); } return 0; } a) process will terminate in the first time b) process will terminate in the second time c) process will never terminate d) none of the mentioned
c) process will never terminate
Explanation:
According to the signal handler function of this program as the SIGINT signal arrives second time, the signal performs its default operation i.e. termination of the process.
Output:
[root@localhost google]# gcc -o san san.c
[root@localhost google]# ./san
^CLinux
^C
[root@localhost google]#