My question here is regarding the allocation of memory space for the variable i.
#include <stdio.h>
int main(int argc, char **argv)
{
switch(1)
{
int i=0; // this declaration is not reached
printf("This line not reached\n");
case 0:
printf("this is case %d\n",i);
break;
case 1:
printf("the value is %d\n",i);
break;
default:
printf("this is the %d \n",i);
}
return 0;
}
So i is an automatic variable so it will be created once it is defined but entering the switch block the line for i definition is not executed. HOw can the program recognize and allocate space for the variable in printf function without encountering the variable i. thanks !