C24. C Selection Statements


Selection Statements

Although C has many operators, it has relatively tew statements, we ve encoun­tered just two so far: the return statement and the expression statement. Most of C's remaining statements fall into three categories, depending on how they affect the order in which statements are executed:
Selection statements. The if and switch statements allow a program to select a particular execution path from a set of alternatives.
Iteration statements. The while, do, and for statements support iteration (looping).
Jump statements. The break, continue, and goto statements cause an unconditional jump to some other place in the program. (The return state­ment belongs in this category, as well.)
The only other statements in C are the compound statement, which groups several statements into a single statement, and the null statement, which performs no action.

No comments: