Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 858987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:36:59+00:00 2026-05-15T08:36:59+00:00

Hi I have a problem with this code. When i am using this function

  • 0

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?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:36:59+00:00Added an answer on May 15, 2026 at 8:36 am

    In the second code, you are comparing signal, which is not even a local variable in the code. In fact, signal as you’ve used it is probably referring to the signal function.

    In contrast, in the first code, you are switching on sig, which is an int parameter to the function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with deserialize document to object using XmlSerializer class. Code my function
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
This is an erlang problem, it seems. I have this code to test the
Here's my problem - I have some code like this: <mx:Canvas width=300 height=300> <mx:Button
I have this simple problem that gets an input from the user using a
I have this problem with signal() : This code compiles fine: #include <stdio.h> #include
I am using the EOF function in my php code. But I have a
I have this problem I'm hoping someone knows the answer to. I have an
I seem to have a problem with this SQL query: SELECT * FROM appts
everybody; I have this problem in asp.net, I have a page where I insert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.