Tuesday, January 5, 2010

Scope of variable

#include < iostream.h >
int a=10;
main()
{
int a=2;
cout < < a < < ::a;
}

what'll be the answer.
In last post i wrote about scope of variables. It'll print local variable value 2 first and print 10. For use global variable we use scope of variable operator i.e '::' .

0 comments:

Post a Comment