#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.
' 'a typo? Did you mean to use a multi character constant?cout<< gvalue<<' ';tocout<< gvalue<<' ';orcout<< gvalue<<" ";for the value that you wanted.