netx_iit

access globle variable using scope resolution operator

Jul 15th, 2020 (edited)
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. /* used of scope resoltuion operator(::)
  2. 1.access globle variable*/
  3. #include<iostream>
  4. using namespace std;
  5. int x=20;//gloable variable
  6. int main()
  7. {
  8.     int x=10;//local variable
  9.     cout<<"value of x is "<<x;
  10.     cout<<"value of x is (globle) "<<::x;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment