Changes the value of a pointer variable. - C++ Data Type

C++ examples for Data Type:Pointer

Description

Changes the value of a pointer variable.

Demo Code

#include <iostream>
using namespace std;
#include <iomanip>
void main()/*from  w  w  w. j a  va2  s. c o  m*/
{
   float v1=123.54;                         
   float v2=900.18;            
   float * p_v;         
   p_v = &v1;           
   cout << "The first value is " << setprecision(2) << *p_v << "\n";                
   p_v = &v2;            
   cout << "The second value is " << setprecision(2) << *p_v << "\n";               
   return;
}

Result


Related Tutorials