1 Answers
Code
#include <iostream>
using namespace std;
int a=5;// global variable
int main()
{
int b=3;//local variable
cout<<“value of b:”<<b;
cout<<“\nGlobal value of a:”<<a;
{
int a = 8;
cout<<“\nvalue of a:”<<a;
}
cout<<“\nvalue of a is:”<<a;
return 0;
}
Output:
value of b:3
Global value of a:5
value of a:8
value of a is:5