C++ Pointer for int type

Description

C++ Pointer for int type

#include <iostream> 
  
using namespace std; 
  
int main(int argc, char *argv [])
{ 
        int     variable = 5; 
        int*    variablePointer = &variable; 
  
        cout << "Value of variable: " << variable << endl; 
  
        cout << "Address of variable: " << &variable << endl; 
  
        cout << "Value of variablePointer: " << variablePointer << endl; 
  
        cout << "Value of variablePointer + 1: " << variablePointer + 1 << endl; 
  
        cout << "Value of memory at dereferenced variablePointer: " << *variablePointer << endl; 
  
        cout << "Value of memory at dereferenced variablePointer + 1: " << *variablePointer + 1 << endl; 
  
        return 0; 
}



PreviousNext

Related