Welcome Guest | Sign in | Register
Functions - Discussion Page For Q.10729 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Functions > Questions and Answers

Q: What is the output of the following code?
main()
{
int i=1;
while (i<=5) { printf("%d",i); if (i>2)
goto here;
i++;
}
}
fun()
{
here:
printf("PP");
}
A. Compiler error: Undefined label 'here' in function main B. PP
C. 1, 2, 3, 4, 5 D. None of these

Answer and Explanation

Answer:Compiler error: Undefined label 'here' in function main

Explanation:
Labels have functions scope, in other words The scope of the labels is limited to functions. The label 'here' is available in function fun () Hence it is not visible in function main.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.