C++ Variable scope resolution operator to reference global variable.

Description

C++ Variable scope resolution operator to reference global variable.

#include <iostream>
using namespace std;
double number = 42.5;         // a global variable named number
int main()/*  w  w  w. j a  v  a 2s  .  c om*/
{
   double number = 26.4;       // a local variable named number
   cout << "The value of number is " << ::number << endl;
   return 0;
}



PreviousNext

Related