Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Predict the output of this code snippet?

Predict the output of this code snippet?

#include <stdio.h>
int main()
{
int i = 3;
switch (i)
{
case 0+1: printf("Conduira");
break;
case 1+2: printf("Online");
break;
default: printf("ConduiraOnline");
}
return 0;
}

A.Conduira
B.Online
C.ConduiraOnline
D.Compiler error
by

1 Answer

akshay1995
Option B
Expression gets evaluated in cases. The control goes to the second case block after evaluating 1+2 = 3 and “Online” is printed.

Login / Signup to Answer the Question.