Saturday 16 March 2013

global variable error


main()
{
printf("%d", out);
}
int out=100;
Answer:
Compiler error: undefined symbol out in function main.
Explanation:
The rule is that a variable is available for use from the point of declaration. Even though a is a global variable, it is not available for main. Hence an error.


Blog Author: Vijay Kumar

Go to: Java Aptitude


No comments:

Post a Comment