Prob comparing pointers and integer in C
- by Dimitri
Hi I have a problem with this code. When i am using this function I have no warnings. :
void handler(int sig){
switch(sig) {
case SIGINT : { click++; fprintf(stdout,"SIGINT recu\n");
if( click == N){
exit(0);
}
}
case SIGALRM : fprintf(stdout,"SIGALRM received\n");
exit(0);
case SIGTERM: fprintf(stdout,"SIGTERM received\n");
exit(0);
}
}
But when i rewrite the function with this new version, I have a " comparison between pointer and integer" warning on the if statement:
void handler( int sig){
printf("Signal recu\n");
if( signal == SIGINT){
click++;
fprintf(stdout,"SIGINT received; Click = %d\n",click);
if(click == N){
fprintf(stdout,"Exiting with SIGINT\n");
exit(0);
}
} else if(signal == SIGALRM){
fprintf(stdout,"SIGALRM received\n");
exit(0);
} else if(signal == SIGTERM){
fprintf(stdout,"SIGTERM received\n");
exit(0);
}
Can someone tell me where is the prob?