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

Home > Java Programming > Switch-case > Questions and Answers

Q: What will be output when you will execute following c code? 
 
#include
int main(){
int const X=0;
switch(5/4/3){
case X: printf("Clinton");
break;
case X+1:printf("Gandhi");
break;
case X+2:printf("Gates");
break;
default: printf("Brown");
}
return 0;
}
Choose all that apply: 
A. Clinton B. Gandhi
C. Gates D. Brown
E. Compilation error

Answer and Explanation

Answer:Compilation error

Explanation:
Case expression cannot be constant variable.

Comment on this Question

Name:

Loading...




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