Answer in brief
Control statements decide which statements execute, how often they execute and when control moves to another part of a program.
Sequential execution
Normally, C executes statements in their written order within a block. For example, reading two values, calculating their sum and printing it is a sequence. Control statements change this flow when a problem requires a choice or repeated work.
Selection statements
- if executes a block when a condition is true.
- if-else chooses between two alternatives. Nested if and an else-if ladder allow several decisions.
- switch selects a starting case using an integer or enumeration value.
Repetition statements
- while checks a condition before each iteration.
- for places initialisation, a condition and an update together.
- do-while checks the condition after the body, so the body runs at least once.
Jump statements
- break leaves the nearest loop or switch.
- continue skips the rest of the current loop iteration.
- goto transfers control to a label in the same function. return leaves the current function.
Example
A marks-processing program may use a loop to read several marks and an if-else statement to display Pass or Fail for each mark. The loop handles repetition, while the decision handles selection. Use braces to show which statements belong to each block. In a condition, zero means false and a non-zero value means true.