title: Checking NULL for array of structures
body: <pre><code>struct student
  {
     int roll;
     char *name;
  };
  
  int main()
  {
    int i;
    struct student arr[2];
    arr[0].roll = 12;
    arr[1].name = "John";
  
    arr[1].roll = 13;
    arr[1].name = "Craig";
  
    struct student *ptr;
  
    ptr=arr;
  
    // This is perfect.
  
    for(i = 0; i&lt;2; i++)
    {
      printf("%d %s", ptr-&gt;roll, ptr-&gt;name);
    }
  
    // This is also ok.
     printf("%d %s", ptr-&gt;roll, ptr-&gt;name);
  
     ptr++ // getting to next structure.
  
     printf("%d %s", ptr-&gt;roll, ptr-&gt;name);
  
    // But this isn't ok
  
    while(*ptr || ptr-&gt;name != NULL)
    {
      ptr++;
    }
  
    return 0;
  }
  </code></pre>
  
  <p>How to check pointer in while loop?</p>