Case can only be constant (#30360)
case can be defined by a constant not by variablepull/28675/head^2
parent
4e2ff2b0bd
commit
48313a48a6
|
@ -10,6 +10,8 @@ It's a list of possibilities, with an action for each possibility, and an option
|
|||
|
||||
We exit from the switch by `break`. If the `break` statement is not reached before the beginning of the next case, the execution will fall through and begin executing the code in the next case, which means if you have no break statement in code, when first case is detected to be true, all the other cases below the one that is detected to be true (including itself) will be executed, which is often undesirable.
|
||||
|
||||
Each case must be a digit or a character i.e.. a constant but not a variable.
|
||||
|
||||
## Syntax of switch...case
|
||||
|
||||
```c
|
||||
|
|
Loading…
Reference in New Issue