c / beginner
Snippet
The for Loop
A for loop is used to repeat code a specific number of times. It bundles initialization, a condition check, and an update step (like incrementing a counter) into a single line.
snippet.c
1
for (int i = 0; i < 3; i++) { printf("Iteration "); }
Breakdown
1
int i = 0;
Initializes a counter variable named i at the start of the loop.
2
i < 3;
The loop continues as long as i is less than 3.
3
i++
Increases the value of i by 1 after each loop iteration.