Question : Problem in switch statement in C

Hello experts, i have a small problem in understanding the behavior of switch statement.
i am attaching a small code. that outputs 811. how does it do ?
Please explain.

Thanks.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
main ( )
{
	int a = 1;
	clrscr( );
	switch(a)
	{
		int b= 88 ;
		case 1:
			printf("%d",b) ;
			break;
		default:
			printf("%d",b) ;
	}
}

Answer : Problem in switch statement in C

The only logical explanation is:
Switch with "cases" is similar to an GOTO label, so when you b declaration and initialization has never happend for this program, I think it's printing rubbish from the memory, because there is no other explanation.

Try compiling it with BCC32(an ANSI C compiler).
You should give us the compiler you are using.
Random Solutions  
 
programming4us programming4us