Home » C Programming » Decision Making » Question
  1. Comment on the output of the following C code.
     #include <stdio.h>
    int main()
    {
    int num = 2;
    switch (num)
    case 1:
    printf("%d", num);
    case 2:
    printf("%d", num);
    case 3:
    printf("%d", num);
    default:
    printf("%d", num);
    }
    1. No error, output is 2
    2. Compile time error, case label outside switch statement
    3. No error, output is 2222
    4. Compile time error, no break statements
    5. None of these
Correct Option: B

Compile time error, case label outside switch statement



Your comments will be displayed only after manual approval.