adplus-dvertising
frame-decoration

Question

What will be output when you will execute following c code?
#include <stdio.h>
int main()
{
 
    int a=2;
    switch(a,a+1)
    {
        case 2:
            printf("You are in b ");
            break;
        case 3:
            printf("You are in c ");
            break;
        default:
            printf("You are in default");
    }
    return 0;
}

a.

You are in b

b.

You are in c

c.

You are in default

d.

Compilation Error

Posted under C Programming

Answer: (b).You are in c

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be output when you will execute following c code?