#include<iostream.h>
#include<conio.h>
int i;       //Global Variable
void main()
{
                int i;       //Local Variable
                clrscr();
                cout<<"The Value of Local Variable I = "<<(unsigned)i<<endl;
                cout<<"The Value of Global Variable I = "<<::i<<endl;
                ::i=17;    //Initialize To Global Variable
                i=69;      //Initialize To Global Variable
                cout<<"The Value of Local Variable I = "<<i<<endl;
                cout<<"The Value of Global Variable I = "<<::i<<endl;
                getch();
}

13.PNG

Advertisements