Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 400 Bytes

scope_resolution_operator.md

File metadata and controls

20 lines (12 loc) · 400 Bytes

Scope resolution operator ::

The :: (scope resolution) is a unary operator that is used to qualify the namespace scope of names.

int n = 12; // A global variable

int main()
{
  	int n = 13; // A local variable

	std::cout << ::n << '\n'; // Print the global variable: 12
	std::cout << n   << '\n'; // Print the local variable: 13
}

code