c - Default case in a switch condition -


i have code:

  #include<stdio.h>                                      int main()   {          int a=10;       switch(a)       {          case '1':           printf("one\n");           break;       case '2':           printf("two\n");           break;       defalut:           printf("none\n");       }          return 0;   } 

the program doesn't print anything, not none. figured out default had typo defalut!
want know why syntax error not detected compiler.

defalut label in program can jump goto. having editor highlights keywords have made error easier spot.

i should note program may have logic errors. character '1' not same 1, , same '2' , 2.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -