Cpp code to access same name of variable from global and also from local? All Questions › Category: Cpp Language › Cpp code to access same name of variable from global and also from local? 0 Vote Up Vote Down Chetan Shidling Staff asked 5 years ago info 1 Answers 0 Vote Up Vote Down Chetan Shidling Staff answered 5 years ago Code #include <iostream> using namespace std; int a=5;//global variable int main() { int a=3;//local variable cout<<“value of a:”<<a; cout<<“\nGlobal value of a:”<<::a; return 0; } By using scope resolution we can access the global variables.