title: In C++, what happens when the delete operator is called?
body: <p>In C++, I understand that the <code>delete</code> operator, when used with an array, 'destroys' it, freeing the memory it used. But what happens when this is done?</p>
  
  <p>I figured my program would just mark off the relevant part of the heap being freed for re-usage, and continue on. </p>
  
  <p>But I noticed that also, the first element of the array is set to null, while the other elements are left unchanged. What purpose does this serve?</p>
  
  <pre><code>int * nums = new int[3];
  nums[0] = 1;
  nums[1] = 2;
  
  cout &lt;&lt; "nums[0]: " &lt;&lt; *nums &lt;&lt; endl;
  cout &lt;&lt; "nums[1]: " &lt;&lt; *(nums+1) &lt;&lt; endl;
  
  delete [] nums;
  
  cout &lt;&lt; "nums[0]: " &lt;&lt; *nums &lt;&lt; endl;
  cout &lt;&lt; "nums[1]: " &lt;&lt; *(nums+1) &lt;&lt; endl;
  </code></pre>