0
Explain the output int main(){ int x=4,y=0; switch(--x) { case 3: y+=x; case 4 : y+=x; default : y++; break ;} printf("%d",y); }
control statement
8 Réponses
+ 2
there is no break statement in case 3 and 4 so the code inside case 4 and default also gets executed.
y=7
+ 2
in the switch x becomes 3 and then y gets incremented by x twice and by 1 a single time.
+ 2
no, 3 is added
+ 2
the value of x is being added. not the value of case
+ 1
Thank you very much 😊
0
Default statement executes we get output 8
0
In case 4 the value of 4 added to x
0
In case 3 = 3
In case 4 = 4
In default = 1
Then total. 8