title: head node in linked list in c
body: <p>while studying linked list in c,i came across 2 different implementations of the head node.
  say if the following is the structure used:</p>
  
  <pre><code>struct node
  {
   int data;
   struct node *next;
  }
  </code></pre>
  
  <p>then the first implementation is where the head node is just a dummy node with no actual data in it, but just a link to another node(the first actual node with data) like this:</p>
  
  <pre><code>struct node *head;
  head-&gt;next = NULL;  //head-&gt;next would then be linked to the first node.
  </code></pre>
  
  <p>the second implementaton is the one where the head node is the first actual node with data in it which is stored using malloc command to allocate space to it.</p>
  
  <p>my question is, how can we use the "head->next" in the first implementation where we havent allocated space for head using malloc at all? because as far as i know(correct me if am wrong), the two fields of the node can only be used once space has been allocated to that node.</p>