English
Language : 

CC78K4 Datasheet, PDF (111/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 6 CONTROL STRUCTURES OF C LANGUAGE
(2) default label
Labeled Statements
default label
FUNCTION
A default label is a special case label used only in the body of a switch statement to specify a process to be
executed by C if the value of the control expression does not match any of the case constants.
SYNTAX
default : statement
EXAMPLE
int f (void), i;
switch (f()) {
case 1:
i=i+4;
break ;
case 2:
i=i+3;
break ;
case 3:
i = i +2 ;
default:
i = 1;
}
EXPLANATION
In the above example, if the return value of f( ) is 1, 2, or 3, the corresponding case clause (statement) is
selected and the expression that follows the case label is executed. Each break statement in the above
example is used to break out of the switch body. If the return value of f( ) is other than 1 to 3, the expression
that follows the default label is executed. In this case, the value of i becomes 1.
User’s Manual U15556EJ1V0UM
111