i=4 is default case for but there is no break statement after default
case. There for all cases until break is encountered will be executed.
so i += 5;  makes i=9
i -= 4; will make i=5
and then break
so i is 5

On Sun, Jun 19, 2011 at 6:29 PM, sahil <[email protected]> wrote:
> #include<stdio.h>
> void main()
> { int i = 4;
>
> switch (i)
> {
>
> default: ;
> case 3:
> i += 5;
> if ( i == 8)
> {
> i++;
> if (i == 9) break;
> i *= 2;
> }
> i -= 4;
> break;
>
> case 8:
> i += 5;
> break;
> }
> printf("i = %d\n", i);
> }
>
>
>
> output:
>
> i=5
>
>
>
> how..........? can sme one explain...!!
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.
>
>



-- 
Sanjay Ahuja,
Analyst, Financing Prime Brokerage
Nomura Securities India Pvt. Ltd

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to