title: How can I check if the value of argv[i] is null and if it is true end the program
body: <pre><code>int main (int argc, char* argv[]){
  
      int toSleep;
      int produce; 
      int consume; 
      int i = 0;
      //get the values for sleep, produce, consume 
      toSleep = atoi(argv[1]);
      produce = atoi(argv[2]);
      consume = atoi(argv[3]);
      //check if the user input a vaild inpusts 
  
      //if(argc !=4){
     //printf("You are missing an input\n");
    //        exit(0);
    //}`enter code here`
      if(toSleep == '\0' ||  produce == '\0' || consume == '\0' ){
          printf("You are missing an input\n");
          exit(0);
      }else if (toSleep &lt;=0 || produce&lt;= 0 || consume &lt;=0 ){
          printf("Please provide a vaild inputs \n");
          exit(0);
      }else {
      //continue to the program 
  }
  </code></pre>
  
  <p>I am trying to make sure that the user will input exactly 3 inputs; if one is missing or null, I should print an error message and terminate the program. I always get this error when I tried to compile it </p>
  
  <blockquote>
  <pre><code>./a4  
   makefile:5: recipe for target 'semaphore' failed make: ***
  [semaphore] Segmentation fault (core dumped)
  </code></pre>
  </blockquote>
  
  <p>Can someone tell me what I did wrong here? </p>