Wednesday 4 February 2015

Scope resolution operator in c++

Scope resolution operator in c++

#include <iostream>
using namespace std;
 
char c = 'a';     // global variable
 
int main() {
  char c = 'b';   //local variable
 
  cout << "Local c: " << c << "\n";      
  cout << "Global c: " << ::c << "\n";  //using scope resolution operator
 
  return 0;
}

No comments:

Post a Comment