Statement Labels

A label is an identifier that allows your program to transfer control to other statements within the same function. It is the only type of identifier that has function scope.

Control is transferred to the statement following the label by means of the goto or switch statements. The case and default label names are reserved for use within the body of the switch statement.

In the examples below, the label is both the identifier and the colon (:) character at the beginning of each line.

comment_complete : ;            /* null statement label */
test_for_null : if (NULL == pointer)

 



Scope of Identifier Visibility


goto Statement
switch Statement