Converted from .HLP to .HTML by HLPTOHTML.

cc .HLP


The break statement terminates the immediately enclosing while, do, for, or switch statement. Control passes to the statement following the terminated statement. The break statement has the following syntax:

break ;


The continue statement passes control to the test portion of the immediately enclosing while, do, or for statement. It has the following syntax:

continue ;

In each of the following statements, a continue statement is equivalent to "goto label;":

while (expression) { statement ... label: ; }

do { statement ... label: ; } while (expression);

for (expression; expression; expression) { statement ... label: ; }

The continue statement is not intended for switches. A continue statement inside a switch statement inside a loop causes reiteration of the loop.


The do statement executes a statement one or more times, as long as a stated condition expression is true. The syntax is as follows:

do statement while ( expression ) ;

The do statement is executed at least once. The expression is evaluated after each execution of the statement. If the expression is not zero, the statement is executed again. The statement following the do statement (the body of the do statement) is not optional; the null statement (a lone semicolon) is provided for specifying a do statement with an empty body.


The for statement executes a statement zero or more times, with three specified control expressions. Expression-1 is evaluated only once, before the first iteration; expression-2 is evaluated before every iteration; expression-3 is evaluated after every iteration. The for loop terminates if, on evaluation, expression-2 is 0. The format of the for statement is as follows:

for ( [expression-1] ; [expression-2] ; [expression-3] ) statement

The for statement is equivalent to the following format:

expression-1; while ( expression-2 ) { statement expression-3; }

You can omit any of the three expressions. If expression-2 is omitted, the while condition is true.


The goto statement transfers control unconditionally to a labeled statement. This statement has the following syntax:

goto identifier ;

The identifier must be a label located in the current function. You may use goto to branch into a block, but no initializations are performed on variables declared in the block.


The if statement is a conditional statement. It can be written with or without an else clause as follows:

if ( expression ) statement if ( expression ) statement else statement

In both cases, the expression is evaluated, and if it is not 0, the first statement is executed. If the else clause is included and the expression is 0, the statement following else is executed instead. In a series of if-else clauses, the else matches the most recent else-less if.


Any statement can be preceded by a label prefix of the following form:


This declares the identifier as a label. The scope of such a declaration is the current function. Labels are used only as the targets of goto statements.


A null statement is a semicolon:


The null statement provides a null action -- for example, the body of a for loop that takes no action:

for(i=0; i < ARRAYSIZE && x[i] == 5; i++) ;


The return statement causes a return from a function, with or without a return value. This statement has the following syntax:

return ; return expression ;

The return value is undefined if not specified in a return statement. If an expression is specified in the return statement, it is evaluated and the value is returned to the calling function; the value is converted, if necessary, to the type with which the called function was declared. If a function does not have a return statement, the effect (on reaching the end of the function) is the same as with a return statement that does not specify an expression. Functions declared as void may not contain return statements specifying an expression.


The switch statement executes one or more of a series of cases, based on the value of an integer expression. This statement has the following syntax:

switch ( expression ) body

The switch's body typically is a block, within which any statement can be prefixed with one or more case labels as follows:

case constant-expression :

At most one statement in the body may have the label as follows:

default :

The switch expression is evaluated and compared to the cases. If there is a case matching the expression's value, it is executed; if not, the default case is executed. The switch is normally terminated by a break, return, or goto statement in one of the cases. If there is no matching case and no default, the body of the switch statement is skipped.


The while statement executes a statement 0 or more times, as long as a stated condition is true. This statement has the following syntax:

while ( expression ) statement

The expression is evaluated before each execution, and the statement is executed if the expression is not 0. The statement following the parentheses (the body of the while statement) is not optional; the null statement (a lone semicolon) is provided for specifying a while statement with an empty body.