Switch case 5 : Multiple Choice Questions in C Programming
Problem Statement 5 : Variables in case labels
void main()
{
int choice = 2 ;
int Num = 3;
switch(choice)
{
case 1 :
printf("\nSachin Tendulkar is better than any other Cricketer in the World");
break;
case Num :
printf("\nI think , Variable is not allowed in Case");
break;
case 7-8+3 :
printf("\nWhat do you Think ?");
break;
}
}
Options : Guess the Output
- Error
- I think , Variable is not allowed in Case
- What do you Think ?
- Sachin Tendulkar is better than any other Cricketer in the World
Why ? Explanation :
- Variables in switch case , not allowed
- Variable in above program is : Num
- To have Constant Expression , Switch Label Should not contain Variable
- For more details ......
Select Switch Case Question :


0 comments
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email