Explain output of this C program

后端 未结 4 2036
我寻月下人不归
我寻月下人不归 2021-01-27 09:08

Found this code at C Puzzles.

#include

int main()
{
  int a=1;
  switch(a)
  {   int b=20;
      case 1: printf(\"b is %d\\n\",b);
                       


        
4条回答
  •  佛祖请我去吃肉
    2021-01-27 09:52

    Inside switch statement nothing will be accepted like assigning values to the variable and printing except inside case. if you want the b value assign it outside the switch . Also b value should be like garbage value it can't change until assign some values to the particular location.

提交回复
热议问题