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<2; i++)
  {
    printf("%d %s", ptr->roll, ptr->name);
  }
  // This is also ok.
   printf("%d %s", ptr->roll, ptr->name);
   ptr++ // getting to next structure.
   printf("%d %s", ptr->roll, ptr->name);
  // But this isn't ok
  while(*ptr || ptr->name != NULL)
  {
    ptr++;
  }
  return 0;
}
How to check pointer in while loop?
 
     
     
     
     
    