title: Delete node from linked list (recursively)
body: <p>!=I am currently working on the following erase recursive bool function that thakes list and int as arguments and return true if the int was found and deleted and false if it was not found in the list. It <em>seems to work</em>, but the <em>problem</em> is that it deletes <strong><em>the next int number</em></strong> in the list, and <strong><em>not the current</em></strong>:</p>
  
  <pre><code> typedef struct E_Type * List;
  
   struct E_Type
   {
          int data;
          List next = 0;
   };
  </code></pre>
  
  <hr>
  
  <pre><code>bool erase(const List &amp; l, int data){
  List current = l;   
  if (current == 0)
  {
     return false;
   }
  else if (current-&gt;data == data)
  {
        List deleteNode = new E_Type;
       deleteNode = current-&gt;next;//probably this causes the error, but how can I point it to the current without crashing the program
       current-&gt;next = deleteNode-&gt;next;
       delete deleteNode;
       return true;
  }
  
  else if (current-&gt;data != data)
  {
        return erase(current-&gt;next, data);
  }
  
  
  }
  </code></pre>