title: Array of char pointers in C - Distinguishing empty elements
body: <p>I have an array of char pointers in C with a size of 10. </p>
  
  <p>I am trying to loop through and print each string out. Not all of the elements are populated and I believe this is causing me an error. How do I check if an element is populated.</p>
  
  <p>This is what I have tried. When I run my code I find that the first element is populated and the value is printed but then I get an error.</p>
  
  <pre><code>char *errors[10];
  ret = doMessages(&amp;h, errors);
  for (i = 0; i &lt; 10; i++)
  {
      if(errors[i] != NULL)
      {
          printf("%s", errors[i]);
      }
  }
  </code></pre>