Using the unary scope resolution operator : Variables « Language Basics « C++ Tutorial






#include <iostream>
using std::cout;
using std::endl;

int n = 7; 

int main()
{
   double n = 10.5;

   cout << "Local double value of n = " << n
      << "\nGlobal int value of n = " << ::n << endl;
   return 0;
}
Local double value of n = 10.5
Global int value of n = 7








1.3.Variables
1.3.1.Assign value to a variable
1.3.2.Dynamic initialization.
1.3.3.A scoping example
1.3.4.Using the unary scope resolution operator
1.3.5.Finding maximum and minimum values for data types
1.3.6.Comparing data values