#include <stdio.h>
int main(void) {
int a = 1;
switch(a) {
int i = 2;
case 1: printf("%d",i);
break;
default: printf("Hello\n");
}
}
The following code sample is giving 36 as the output. How is this possible? I understand that the compiler will transfer the control to case 1 directly, without evaluating i
. But, why am I getting the output as 36?
PS: I am using GCC.