C32. C Case Constant Expression

case constant-expression :
A constant expression is much like an ordinary expression except that it can't contain variables or function calls. Thus, 5 is a constant expression, and 5 + 10 is a constant expression, but n + 10 isn't a constant expression (unless n is a macro that represents a constant). The constant expression in a case label must evaluate to an integer (characters are also acceptable).
Statements. After each case label comes any number of statements. No braces are required around the statements. (Enjoy it—this is one of the few places in C where braces aren't required.) The last statement in each group is normally break.
Duplicate case labels aren't allowed. The order of the cases doesn't matter; in par­ticular, the default case doesn't need to come last.
Only one constant expression may follow the word case; however, several case labels may precede the same group of statements.

No comments: