#include<iostream>
using namespace std;
int gvalue=10;
void extra(){
cout<< gvalue<<' ';
}
int main()
{
extra();
{
int gvalue=20;
cout<<gvalue<<' ';
cout<<gvalue<<' ';
}
}
The output which I got was: 10822420 20
I cannot get what is the error? & what does the below section of code mean & work?
extra();
{
int gvalue=20;
cout<<gvalue<<' ';
cout<<gvalue<<' ';
}
Thanks in advance..!! Ignore the bad English.