Sunday, October 12, 2008

What is the output of following programme ?

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);

Choice a: i = 5
Choice b: i = 8
Choice c: i = 9
Choice d: i = 10
Choice e: i = 18

No comments: