Labeled Statements
Each statement in a program can be labeled. A label is an identifier added before the statement like this:
label_identifier: statement;
There is no special declaration of a label – it just “tags” the statement
. Label_identifier
has a function scope and the same label cannot be redefined within the same function.
Labels have their own namespace: label identifier can match any other identifier in the program.
A statement can be labeled for two reasons:
-
The label identifier serves as a target for the unconditional goto statement,
-
The label identifier serves as a target for the switch statement. For this purpose, only
case
anddefault
labeled statements are used:case constant-expression : statement
default : statement
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
What do you think about this topic ? Send us feedback!