Mega Code Archive

 
Categories / C++ Tutorial / Pointer
 

Finding Out What Is Stored in Pointers

#include <iostream> int main() {    using namespace std;    unsigned short int myAge = 5, yourAge = 10;    unsigned short int * pAge = &myAge;    cout << myAge <<  "  " << yourAge << endl;    cout << &myAge << " " << &yourAge << endl;    cout << pAge << " " << *pAge << endl;    pAge = &yourAge;       cout << myAge << " " << yourAge << endl;    cout << &myAge << " " << &yourAge << endl;    cout << pAge << endl;    cout << *pAge << endl;    cout << " " << &pAge << endl;    return 0; }