C++ examples for Data Type:Pointer
Access value using pointers
#include <iostream> using namespace std; int main()/* w w w . j av a 2s. co m*/ { int var1, var2; int* ptr; //pointer to integers ptr = &var1; //set pointer to address of var1 *ptr = 37; //same as var1=37 var2 = *ptr; //same as var2=var1 cout << var2 << endl; //verify var2 is 37 return 0; }