C++ Pointer as address variables
#include <iostream> using namespace std; int main()//from w w w. ja v a 2 s . co m { int var1 = 11; int var2 = 22; cout << &var1 << endl //print addresses of variables << &var2 << endl << endl; int* ptr; //pointer to integers ptr = &var1; //pointer points to var1 cout << ptr << endl; //print pointer value ptr = &var2; //pointer points to var2 cout << ptr << endl; //print pointer value return 0; }