title: C++ - Why set object to null after deleting?
body: <p>I am looking at the following piece of linked list code I found online:</p>
  
  <pre><code>void DeleteAfter(Node **head){
        if(*head==NULL){
              return;
        }else{
              Node *temp = NULL;
              temp = (*head)-&gt;next;
              (*head)-&gt;next = (*head)-&gt;next-&gt;next;
              delete temp;
              temp=NULL;
        }
  }
  </code></pre>
  
  <p>I am not that skilled with C++, so this could be a bad question, but why is temp being set to NULL after being deleted? Is this a necessary step?</p>