#include using namespace std; int main() { double *p; // a pointer is created for double type, // but currently points nowhere p = new double; // memory is allocated to store a double value, // but currently not initialized. // p now points to that location *p = 17.5; // memory location pointed by p contains 17.5 cout << "memory location at address " << p << " contains " << *p << endl; double *q = NULL; //q = (double *)0x003960c8; //q = 123.45; if (q != NULL) cout << *q << endl; q = p; // q points to the same memory location as p // *q = *p; cout << "memory location at address " << q << " contains " << *q << endl; *q = *p + 1; cout << *q << " " << *p << endl; return 0; }