Control Structure


A statement that is used to control the flow of execution in a program is called control structure. The control structure in C programming language is used to combine individual instruction into a single logical unit. The logical unit has one entry point and one exit point.

The instructions in a program can be organized in three kinds of control structures to control execution flow. The control structures are used to implement the program logic.


Types of Control Structure:

The following are the types of control structures in C programming language:

Sequence:

In sequential structure, the statements are executed in the same order in which they are specified in the program. The control flows from one statement to other in a logical sequence. All statements are executed exactly once. It means that no statement is skipped and no statement is executed more than once.

Selection:

A selection structure selects a statement or set of statements to execute on the basis of a condition. In this structure, statement or set of statements is executed when a particular condition is true and ignored when the condition is false. There are different types of selection structures. These are if, if else and switch.

Repetition:

A repetition structure executes a statement or set of statements repeatedly. It is also known as iteration structure or loop. The repetition structures include ‘for loop’, ‘while loop’, and ‘do while loop’.

Function call:

Function call is a type of statement that moves the control to other block of code. The control returns back after executing all statements in the block. The remaining statements are executed immediately after the function call when the control is returned.