C Programming/C Loop Statement

C Loop Introduction

Updated on January 9, 2026
1 min read

what is Loop?

loop is a programming structure used to repeat a set of instructions multiple times until a given condition is met.

Instead of writing the same code again and again, we use loops.

Why do we need loops?

Without loop i we want to print Hello 4 times then:

printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");

With loop 

for(int i = 1; i <= 4; i++) {
    printf("Hello\n");
}
  • Code becomes shorter
  • Easy to read
  • Easy to modify
  • Saves time

Real-Life Example

  • Teacher takes attendance every day
  • Alarm rings every morning
  • Echo runs on his wheel again and again

All these are loops in real life.

How a Loop Works

Every loop has three main parts:

1. Initialization

 → Starting point

int i = 1;

2. Condition

 → Loop runs while condition is true

i <= 5

3. Update (Increment / Decrement)

 → Changes value to avoid infinite loop

i++

Types of Loops in C Language

C has 3 main types of loops:

  1. For Loop
  2. While Loop
  3. Do-While Loop
C Loop Introduction | C Programming | Learn Syntax