Default case in a switch condition

前端 未结 3 1843
太阳男子
太阳男子 2020-12-03 17:04

I have this code:

  #include                                   
  int main()
  {   
      int a=10;
      switch(a)
      {   
      case \'1\         


        
3条回答
  •  悲&欢浪女
    2020-12-03 17:33

    tip: if you are using gcc, add the option -pedantic. it will warn you for unused labels:

    $ gcc -ansi -Wall -pedantic test.c -o test
    test.c: In function ‘main’:
    test.c:14:10: warning: label ‘defalut’ defined but not used
    

提交回复
热议问题