Possible Duplicate:
Why can't variables be declared in a switch statement?
How can a variable be used when its definition is bypassed?
#include<stdio.h>
int main()
{
int a=1;
switch(a)
{ int b=20;
case 1: printf("b is %d\n",b);
break;
default:printf("%d\n",b);
break;
}
return 0;
}
ran on gcc 4.6.3, output not 20. What is going on here?