Multiple choice

What is the output of the given C code?

int main()
{
bool i;
if(i) switch(i++) // Line 1
{
default : printf("No Value");
case 0 : printf("\\ni is 0");
case 1 : printf("\\ni is 1");
case 2 : printf("\\ni is 2");
}
}

  1. No value. i is 0i is 1i is 2

  2. i is 0i is 1i is 2

  3. i is 1i is 2

  4. No output

  5. Compilation error

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This is the correct choice.