The controlling expression of a switch statement
shall have integer type.
If a switch statement has an associated
case or default label within
the scope of an identifier with a variably modified type, the entire
switch statement shall be within the scope of that
The expression of each case label shall be an
integer constant expression and no two of the case
constant expressions in the same switch statement
shall have the same value after conversion.
There may be at most one default label in a
(Any enclosed switch statement may have a
default label or case constant
expressions with values that duplicate case
constant expressions in the enclosing switch
A switch statement causes control to jump to,
into, or past the statement that is the switch body, depending
on the value of a controlling expression, and on the presence of a
default label and the values of any
case labels on or in the switch body.
A case or default label is
accessible only within the closest enclosing
The integer promotions are performed on the controlling expression.
The constant expression in each case label is
converted to the promoted type of the controlling expression.
If a converted value matches that of the promoted controlling
expression, control jumps to the statement following the matched
Otherwise, if there is a default label, control
jumps to the labeled statement.
If no converted case constant expression matches
and there is no default label, no part of the
switch body is executed.
As discussed in 220.127.116.11, the implementation may limit the number of
case values in a switch
133) That is, the declaration either precedes the
switch statement, or it follows the last
case or default label
associated with the switch that is in the block
containing the declaration.
int i = 4;
i = 17;
/* falls through into default code */
the object whose identifier is i exists with
automatic storage duration (within the block) but is never
initialized, and thus if the controlling expression has a nonzero
value, the call to the printf function will access
an indeterminate value. Similarly, the call to the function
f cannot be reached.