title: insert single linked list at the end recursively in c
body: <p>Can anyone tell me what is wrong with my code?<br>
  I want to create non- return function <code>void</code> to insert a node at the end of linked list.</p>
  
  <pre><code>void insert_tail_Recursively(struct node **phead, int key) {
    if (*phead == NULL) {
      Node*temp = malloc(sizeof(Node));
      temp-&gt;data = key;
      temp-&gt;pLeft = temp-&gt;pRight = NULL;
      *phead = temp;
    } else {
      Node*temp = malloc(sizeof(Node));
      temp-&gt;data = key;
      temp-&gt;pLeft = temp-&gt;pRight = NULL;
  
      /* data more than root node data insert at right */
      if ((temp-&gt;data &gt; (*phead)-&gt;data) &amp;&amp; ((*phead)-&gt;pRight != NULL)) 
        insert_tail_Recursively((*phead)-&gt;pRight, key);
      else if ((temp-&gt;data &gt; (*phead)-&gt;data) &amp;&amp; ((*phead)-&gt;pRight == NULL)) {
        (*phead)-&gt;pRight = temp;
  
      }
  
      /* data less than root node data insert at left */
      else if ((temp-&gt;data &lt; (*phead)-&gt;data) &amp;&amp; ((*phead)-&gt;pLeft != NULL)) 
        insert_tail_Recursively((*phead)-&gt;pLeft, key);
      else if ((temp-&gt;data &lt; (*phead)-&gt;data) &amp;&amp; ((*phead)-&gt;pLeft == NULL)) {
        (*phead)-&gt;pLeft = temp;
      }
    }
  }
  </code></pre>