title: Dereferencing a pointer to a structure
body: <p>I recently encountered this question.</p>
  
  <p>A singly linked list was created, the node for the list looked like</p>
  
  <pre><code>struct node
  {
      int data;
      struct node* link;
  };
  </code></pre>
  
  <p>The list was created using add at head, the list looks like</p>
  
  <p>100->200->300</p>
  
  <p>The display function was written as</p>
  
  <pre><code>void display(struct node* head)
  {
      while(head != NULL)
      {
          printf ("%d", *head);
          head=head-&gt;next;
      }
  }
  </code></pre>
  
  <p>Is this a legal way of accessing the data in the list? I tied it against the GCC compiler, it threw a warning but it worked. Would it lead to errors for some cases?</p>