title: How to check for NULL pointer in C?
body: <p>I have a homework in C for this semester, and the teacher said I should write this function not that complicated. 
  I'm new to programming, and I can't seem to find the answer. He said we did some of this type of stuff in class, but I couldn't find anything like this.</p>
  
  <pre><code>int checkforerror(int argc){
      if (argc != 3) {
          fputs("Too little or too many arguments!\n", stderr);
          exit(EXIT_FAILURE);
      }
  }
  </code></pre>
  
  <p>Also he pointed out, that I have to check for nullpointer in a function. I found some nullpointer check in some programs which we wrote in class, but I'm not sure it's good this way. </p>
  
  <pre><code>int mycmp(char *s1, char *s2){
  
      if (!(s1 &amp;&amp; s2))
         return EXIT_FAILURE;
  </code></pre>
  
  <p>So we did something like this in lessons.
  Also I tought about this:</p>
  
  <pre><code>if (s1 == NULL &amp;&amp; s2 == NULL)
     return EXIT_FAILURE;
  </code></pre>
  
  <p>I don't really know whether they are really null pointer checks and which should I use.</p>
  
  <p>Can you please help me with these?</p>