![]() |
![]() |
![]() |
![]() |
![]() |
|
switch (integer-producing expression) {
case integer literal 1: statements for integer 1 break;
case integer literal 2: statements for integer 2 break;
...
default: default statements
}
switch statements, you can omit the keyword
default: and the default statements.
switch statements, the integer-producing expression can
produce a value belonging to any of the integral data types, including
the char data type.
switch statements, once embedded-statement execution begins,
execution continues up to the first embedded break or
return statement, or to the end of the switch statement,
whichever comes first. Bugs emerge when you forget to pair case
keywords with break or return statements.