Need help solving a C-based programming puzzle

前端 未结 5 1926
栀梦
栀梦 2021-01-13 14:32

I came across this puzzle here. I can\'t figure out why NONE is not printed. Any ideas?

#include
int main()
{
      int a=10;         


        
5条回答
  •  甜味超标
    2021-01-13 15:12

    defa1ut: is a syntactically valid label, e.g. for a goto but not the default of the switch statement.

    If you compile with gcc with enough warnings it will point this out:

    ajw@rapunzel:/tmp > gcc -Wall -Wextra test.c
    test.c: In function ‘main’: test.c:13:15: warning: label ‘defa1ut’ defined but not used

    It's a good argument for building with warnings cranked up high and aiming for 0 warnings in every build.

提交回复
热议问题