title: C segmentation fault when passing a NULL pointer despite a conditional telling the function not to run if a NULL parameter is passed?
body: <p>I have a program which handles an array of strings. One of the methods removes a string from a specified position in said array. The code is as follows:</p>
  
  <pre><code>void RemoveStringAt(char *array[], int pos)
  {
      if((array[pos]!=NULL)&amp;&amp;(array!=NULL)&amp;&amp;(pos!=NULL))
      {
          free(array[pos]);
          array[pos]=NULL;
      }
  }
  </code></pre>
  
  <p>One of the specifications of the project was that it should not cause a seg fault when passing a NULL value. Here's what happened when I tried:</p>
  
  <pre><code> RemoveStringAt(NULL, NULL);
  </code></pre>
  
  <p>And the output:</p>
  
  <pre><code>Segmentation fault (core dumped)
  </code></pre>
  
  <p>Why would I be getting a segmentation fault if one of the conditions for even executing the core part of the method is that none of the values passed can be NULL?</p>