When the name of both the variables are the same then we will call the variable (for example take it as "x"), then by default, the system will consider the local variable by this call. But if you want to call global variable then you have to use a special operator SCOPE RESOLUTION OPERATOR (::), then it will refer to the global variable
local variable: cout<<x;
global variable: cout<<::x;