title: understanding the logic behind the new and delete operators in c++
body: <p>Im trying to understand the delete operator in c++.</p>
  
  <p>I could understand the logic behind using pointers and new operator, yet I understood that "<em>The delete operator eliminates a dynamic variable and returns the memory that the dynamic variable occupied to the freestone.</em>" p517, Problem solving with C++ 9th edition. </p>
  
  <p>which, I think doesn't align with the third cout statement. and I expected that the third cout statement to be sth similar to the first one.</p>
  
  <pre><code>int main() {
      int  *p1;
      cout &lt;&lt; "p1 address: " &lt;&lt; &amp;p1 &lt;&lt; " and points to the address "&lt;&lt; p1 &lt;&lt; " which has the value: " &lt;&lt; *p1&lt;&lt; endl;
  
      p1 = new int;
      cout &lt;&lt; "p1 address: " &lt;&lt; &amp;p1 &lt;&lt; " and points to the address "&lt;&lt; p1 &lt;&lt; " which has the value: " &lt;&lt; *p1&lt;&lt; endl;
  
      delete p1;
      cout &lt;&lt; "p1 address: " &lt;&lt; &amp;p1 &lt;&lt; " and points to the address "&lt;&lt; p1 &lt;&lt; " which has the value: " &lt;&lt; *p1&lt;&lt; endl;
  
      cout &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>I would appreciate any explanation :))</p>