?
What is the output of the below code?
What is the output of the below code?
void sig_handler ( int signum) {
printf(“Handled the signal\n”);
}
int main() {
int pid;
signal (SIGKILL, sig_handler);
pid = fork();
if (pid==0) {
kill(getppid(), SIGKILL);
exit(0);
} else {
sleep(20);
}
return 0;
}
void sig_handler ( int signum) {
printf(“Handled the signal\n”);
}
int main() {
int pid;
signal (SIGKILL, sig_handler);
pid = fork();
if (pid==0) {
kill(getppid(), SIGKILL);
exit(0);
} else {
sleep(20);
}
return 0;
}
Join the Discussion
Login to post a comment or share your explanation.
Login