// z6.3.1-new.cc // #include using namespace std; int main() { int* myPtr = nullptr; cout << "myPtr: " << myPtr << endl; // Next line would cause error because myPtr is null // cout << "*myPtr: " << *myPtr << endl; // ERROR // new allocates int, returns pointer myPtr = new int; cout << "myPtr: " << myPtr << endl; cout << "*myPtr: " << *myPtr << endl; *myPtr = 555; cout << "*myPtr: " << *myPtr << endl; return 0; }