C++ examples for Data Type:Pointer
Print Out Addresses using pointers
#include <iostream> #include <stdlib.h> using namespace std; int main()//from w w w . j a v a 2 s .c om { int a = 2, b = 3, c = 4; int *pa = &a; int *pb = &b; int *pc = &c; cout << "Value of pointer pa is: " << pa << endl; cout << "Value of pointer pb is: " << pb << endl; cout << "Value of pointer pc is: " << pc << endl; cout << "The values of a, b, and c are: "; cout << a << ", " << b << ", " << c << endl; return 0; }