Mega Code Archive

 
Categories / C++ / Pointer
 

Indirection Operator and Dereferencing

#include <iostream> using namespace std; int main () {    int num = 5;    int* intPointer = &num;    cout << "The value of num is " << num << endl;    num = 10;    cout << "The value of num after num = 10 is " << num << endl;    *intPointer = 15;    cout << "The value of num after *intPointer = 15 is " << num << endl;    return 0; }