title: How to check whether a struct's member is NULL in C?
body: <p>I got a problem with checking whether a member of a struct is null or not. For example:</p>
  
  <pre><code>typedef struct {
      int value;
  } A;
  
  int main() {
     A *foo = malloc(sizeof(A));
     foo-&gt;value++; // obviously, null pointer error
  }
  </code></pre>
  
  <p>Then I attempted to check whether value is NULL or not by:</p>
  
  <pre><code>if (foo-&gt;value != NULL) {
      foo-&gt;value++;
  }
  </code></pre>
  
  <p>But the error occured: <strong>comparison between pointer and integer.</strong></p>
  
  <p>What should I do? Note that set it to <code>0</code> is not an option in my circumstance.</p>