SCOPE

Home >> Sem 2 >> C++ programs >> SCOPE

/* Write a Program which illustrates the use of scope resolution operator */
#include<iostream.h>
#include<conio.h>
int a=100;

void main()
 {
   clrscr();
  {
    int a=15;
      {
        int a;
        a = 40;
         cout << "###### We are in Inner Block ######\n";
         cout<<"A ==> " << a <<"\n";
         cout<<"::A ==> "<<::a<<"\n";
      }
         cout<<"##### We are in Outer Block ######\n";
         cout<<"A ==> " <<a<<endl;
         cout<<"::A ==> "<<::a<<endl;
   }
 getch();
}