Scope resolution operator in C++

:: is called scope resolution operator, it is used to access global version of a variable.
using namespace std;
// here x is global variable
int x=100; 

int main(){
// here x is local variable for main function
int x=10;

// accessing local variable

// accessing global version of x variable using scope resolution operator

return 0;
© 2016 - 2022, All Rights are Reserved.