Modifying the Original Variable with a Pointer Variable - C++ Data Type

C++ examples for Data Type:Pointer

Description

Modifying the Original Variable with a Pointer Variable

Demo Code

#include <iostream> 

using namespace std; 

int main() /*from w w  w . j a  v a 2  s .  c  o  m*/
{ 
  int a = 100; 
  int *ptr; 

  ptr = &a; 

  *ptr = 60; 

  cout << a << endl; 

  return 0; 
}

Result


Related Tutorials