Why does the code excute, but I get no print message?
Could someone give me some kind of technical explanation why the follow code will execute, but won't print anything out?
Code:
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
static void sig_alarm(int signo) {
if(signo == SIGALRM)
printf("Signal Caught \n");
}
unsigned int sleep1(unsigned int nsec){
if(signal(SIGALRM,sig_alarm) == SIG_ERR){
return(nsec);
}
alarm(nsec);
pause();
return(alarm(0));
}
int main(void) {
sleep(5);
return 0;
}
Thanks