PROGRAM CONTROL STRUCTURES
A control structure is a block of code that manages the flow
of execution in a program.
Control structures dictate the order in which statements are
executed based on certain conditions.
Types of control structures:
1. Sequential Structure
2. Selection Structure (Conditional Statements)
3. Repetition Structure (Loops)
Sequential Structure
The default structure where statements are executed
one after the other in sequence.
Example:
Selection Structure (Conditional Statements)
Allows the program to make decisions and execute
different blocks of code based on specified conditions.
All conditional statements available in C language are
mentioned below:
1. if statement
2. if else
3. ladder if else if………else
4. nested if
5. ternary
6. switch case
Syntax of if else statement
Syntax of a ladder if else statement
Syntax of a nested if else statement
Syntax of ternary conditional statement
Repetition Structure (Loops):
Allows the execution of a block of code repeatedly as
long as a specified condition is true.
Types of loops in C language are mentioned below:
1. Entry Controlled Loop: while loop, and for loop
2. Exit Controlled Loop: do while loop
Syntax of a while loop
Syntax of a do while loop
Syntax of for loop