The code is valid. If there is no
default: label and none of the
case labels match the “switched” value, then none of the controlled compound statement will be executed. Execution will continue from the end of the switch statement.
ISO/IEC 9899:1999, section 126.96.36.199:
[…] If no converted
caseconstant expression matches and there is no
defaultlabel, no part of the switch body is executed.
- Is ‘switch’ faster than ‘if’?
- Valid, but worthless syntax in switch-case?
- Switch statement: must default be the last case?
- This source code is switching on a string in C. How does it do that?
- How can I compare strings in C using a `switch` statement?
- Switch statement with returns — code correctness [closed]
- C Switch-case curly braces after every case
- Should we break the default case in switch statement?
- “register” keyword in C?
- Why is the asterisk before the variable name, rather than after the type?
- Is errno thread-safe?
- What is the C runtime library?
- Warning/error “function declaration isn’t a prototype”
- What tools are there for functional programming in C?
- DESTDIR and PREFIX of make
- Are parallel calls to send/recv on the same socket valid?
- How to declare a structure in a header that is to be used by multiple files in c?
- What’s the need of array with zero elements?
- How to list files in a directory in a C program?
- Why is printf with a single argument (without conversion specifiers) deprecated?
- How to empty a char array?
- What is the time complexity of my function? [duplicate]
- Using fflush(stdin)
- Why is assigning a value to a bit field not giving the same value back?
- #ifdef inside #define
- String Padding in C
- Why is a point-to-volatile pointer, like “volatile int * p”, useful?
- state machines tutorials [closed]
- Can I assume the size of long int is always 4 bytes?
- Is declaration of variables expensive?
- Variable declaration in a header file [duplicate]
- Is a^a or a-a undefined behaviour if a is not initialized?
- What is the simplest standard conform way to produce a Segfault in C?
- Why does open() create my file with the wrong permissions?
- What is the purpose of the h and hh modifiers for printf?
- Why are LIB files beasts of such a duplicitous nature?
- How do you get a directory listing in C?
- What is the difference between xmalloc and malloc?
- List of all users and groups
- Why can’t the C compiler optimize changing the value of a const pointer assuming that two pointers to the same variable would be illegal/UB?
- Does readdir() guarantee an order?
- C++ Force compile-time error/warning on implicit fall-through in switch
- Where is the bluetooth/bluetooth.h located in Linux?
- How to create a C compiler for custom CPU?
- difference between “ifndef” and “if !defined” in C?
- Is &errno legal C?
- Should I ever use continue inside a switch statement?
- How does printf and co differentiate between float and double
- If the size of “long” and “int” are the same on a platform – are “long” and “int” different in any way?
- argv[argc] ==?