default keyword |
Catch-all label in switch statement
|
statement := default : statement
|
|
A switch statement jumps to the
default label if no case matches the switch
expression. A switch statement can have at most
one default label. If there is no
default and the expression does not match any
cases, control jumps directly to the statement that follows the
switch statement.
Example
switch(c) {
case '+': ... break;
case '-': ... break;
default:
cerr << "unknown operator: " << c << '\n';
break;
};
See Also
break, case,
statement, switch, Chapter 4
|