Write a Program in C++ That Uses of Unary Scope Resolution Operator

// Unary scope resolution operator.
#include <iostream>
using namespace std;

int number = 7; // global variable named number

int main()
{
   double number = 10.5; // local variable named number

   // display values of local and global variables
   cout << "Local double value of number = " << number
      << "\nGlobal int value of number = " << ::number << endl;
} // end main

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...