title: Deleting elements from link list(through recursion)
body: <p>Now the problem here is that it's working for every value except first and ones those do not exist in the list... The program returns a garbage value and crashes. (Trying to do via recursion btw)</p>
  
  <pre><code>bool deleteValue(student *head, int id) {
      student *curr, *prev;
      if (head != NULL)
      {
          curr = head-&gt;next;
          prev = head;
          if ((curr-&gt;data == id) &amp;&amp; (curr-&gt;next != NULL))
          {
              prev-&gt;next = curr-&gt;next;
              delete(curr);
              return true;
          }
          if (head-&gt;data == id)
          {
              student *temp = head;
              head = head-&gt;next;
              delete temp;
              return true;
          }
          if ((curr-&gt;data == id) &amp;&amp; (curr-&gt;next == NULL))
          {
              delete head-&gt;next;
              head-&gt;next = NULL;
              return true;
          }
          else
          {
              return deleteValue(head-&gt;next, id);
          }
      }
      else
      {
          return false;
      }
  }     // function
     // delete
  
  cout &lt;&lt; "Student has ";
  if (deleteValue(head, 15) == true) {
      cout &lt;&lt; "been ";
  }
  else {
      cout &lt;&lt; "not been ";
  }
  cout &lt;&lt; "deleted. ";
  print(head); // function being called
  </code></pre>