DeletePointer

DeletePointer - } *p = z ; cout <<...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std ; int main() { int x = 1, y = 2, z = 3 ; int *p = &x ; cout << "p: " << p << ", *p: " << *p << endl ; p = new int ; if (p == NULL) { cout << "Memory allocation failed." << endl ;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } *p = z ; cout &lt;&lt; &quot;p: &quot; &lt;&lt; p &lt;&lt; &quot;, *p: &quot; &lt;&lt; *p &lt;&lt; endl ; delete p ; cout &lt;&lt; &quot;p: &quot; &lt;&lt; p &lt;&lt; &quot;, *p: &quot; &lt;&lt; *p &lt;&lt; endl ; }...
View Full Document

Ask a homework question - tutors are online