Home » C Programming » Decision Making » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    int n = 10, m = 10;
    switch (n)
    {
    case n*m:
    printf("True ");
    case n-m:
    printf("False\n");
    break;
    }
    }
    1. 10
    2. Compilation Error
    3. 10
    4. True
    5. False
Correct Option: B

Compilation Error

In function 'int main()':
error: 'n' cannot appear in a constant-expression
case n-m:
error: 'm' cannot appear in a constant-expression
case n*m:
error: 'n' cannot appear in a constant-expression
case n-m:
error: 'm' cannot appear in a constant-expression
case n-m:



Your comments will be displayed only after manual approval.