Control flow constructs in C.

Chapter 3: Control Flow

Control flow constructs in C.

If Statements #

C provides the if, if-else, if-elseif, and if-elseif-else basic control flow expressions.

if (/** condition */) {
/** statement(s) */
} else if (/** condition */) {
/** statement(s) */
} else {
/** statement(s) */
}

Switch Statements #

switch (/** expression */) {
case /** const-expression */:
/** statement(s) */;
break;
case /** const-expression */:
/** statement(s) */;
break;
default:
/** statement(s) */;
break;
}

Loops #

for (/** initializer */; /** condition */; /** accumulator */) {
/** statement(s) */
}
while (/** condition */) {
/** statement(s) */
}
do {
/** statement(s) */
} while (/** condition */);