title: how the head pointer is still pointing to first element after travesing it in isert_at_end function?
body: <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt; 
  #include &lt;string.h&gt; 
  #include &lt;math.h&gt; 
  #include &lt;stdlib.h&gt; 
  #define MAXSIZE 10 
  int count=0; 
  
  typedef struct list_node 
  { 
      int item; 
      struct list_node *next; 
  }node; 
  void insert_at_beginning(node **head_addr, int value) 
  { 
      if(count==MAXSIZE){ 
          printf(&quot;List can not accommodate more than 10 elements\n&quot;); 
          exit(0); 
      }
  
      node *new_node; 
      new_node=(node *) malloc(sizeof(node)); 
      new_node-&gt;item=value; 
      new_node-&gt;next= *head_addr; 
      *head_addr=new_node; 
      count++; 
  }
  void insert_at_end(node **head_addr, int value) 
  {
      if(count==MAXSIZE) { 
          printf(&quot;List can not accommodate more than 10 elements\n&quot;); 
          exit(0);
      }
  
      while(*head_addr != NULL){ 
          head_addr=&amp;((*head_addr)-&gt;next); 
      }
  
      insert_at_beginning(head_addr,value); 
  }
  
  int main()
  {
      node *head=NULL;
      insert_at_beginning(&amp;head,1);
      insert_at_beginning(&amp;head,0);
      insert_at_end(&amp;head,2);
      return 0;
  }
  
  </code></pre>
  <p>my question is after traversing in insert_at_end function when i use insert_at_beginning still it add at beginning  how can it done?
  my code is working fine but i just wondering this thing.
  i don't need to create any temp pointer to traverse</p>