C++ examples for Data Type:Pointer
Using int pointer
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv []) { int anInt = 5; int *anIntPointer = &anInt; cout << "anInt = " << anInt << endl; cout << "*anIntPointer = " << *anIntPointer << endl; cout << endl; //from w w w .j a v a2 s .c o m *anIntPointer = 100; cout << "anInt = " << anInt << endl; cout << "*anIntPointer = " << *anIntPointer << endl; cout << endl; anInt = 50; cout << "anInt = " << anInt << endl; cout << "*anIntPointer = " << *anIntPointer << endl; cout << endl; return 0; }