Control Structure in C language
3 min readDec 6, 2023
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:
- Sequential Structure
- Selection Structure (Conditional Statements)
- Repetition Structure (Loops)
Let’s see each of them in brief:
Sequential Structure
- The default structure is 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:
- if statement
- if else
- ladder
- nested
- ternary
- switch case
- Let’s see the syntax of each of them:
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:
- Entry Controlled Loop: while loop, and for loop
- Exit Controlled Loop: do while loop
- Let’s see the syntax of each of them:
Thanks for reading this article ❤️
If I got something wrong 🙈, Let me know in the comments. I would like to improve.
Clap 👏 If this article helps you. Add to your 📑 Reading list for future reference.