0
According to book the code give output like local =10. Global =20 ,Global+Local=30.but in this it give different values ??
3 Answers
+ 2
HRITIK.DIYUNDI
Line 9 should be:
cout<<"\nGlobal = "<< ::num<<endl;
+ 1
Mihai Apostol thank you for your help
0
cout<<"\nGlobal = "<<::num<<endl;
You missed the colon infront of num in second line. In your code,first line and second line is same, you are printing the num which is local variable. To print global variable use ::num