home
clear breadcrumbs
search
login
 
pointer examples
#include
using namespace std; int main() { int var = 20; // actual variable declaration. int* ip; // pointer variable ip = &var; // store address of var in pointer variable (Address-of operator (&)) cout << "Value of var variable: "; cout << var << endl; // print the ADDRESS stored in ip pointer variable cout << "Address stored in ip variable: "; cout << ip << endl; // access the VALUE at the address available in pointer (Dereferencing (*)) cout << "Value of *ip variable: "; cout << *ip << endl; return 0; }