cpp_programming/Scope_resolution_operator at master · Lavin-tom/cpp_programming · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

Scope Resolution operator(::)

To access global variable when there is local varibale with same.

example:

#include<iostream>
using namespace std;
int x=10;
int main()
{
	int x=200;
	cout<<"local x: "<<x<<endl;
	cout<<"global x: "<<::x<<endl;
}

output:
local x: 200
global x: 10

Next