C Programming/C Loop Statement

C Loop Control Statement

Updated on January 9, 2026
3 min read

Break Statement in C

We’ll cover breakcontinue, and goto (briefly), with clear examples.

Loop control statements are used to:

  • Change the normal flow of a loop
  • Stop a loop early
  • Skip certain iterations

They give extra control over loops.

1. break Statement

What break does

  • Immediately terminates the loop
  • Control goes outside the loop

Example

c
1
2#include <stdio.h>
3
4int main() {
5    int i;
6
7    for (i = 1; i <= 5; i++) {
8        if (i == 3)
9            break;
10        printf("%d ", i);
11    }
12
13    return 0;
14}

Output

1 2

Explanation

  • Loop stops when i == 3
  • Remaining iterations are skipped

Continue Statement in C

in previous chapter we will learn about break statement, now here we cover continue statement. and next go to statement.

2. continue Statement

What continue does

  • Skips the current iteration
  • Loop continues with the next iteration

Example

c
1
2#include <stdio.h>
3
4int main() {
5    int i;
6
7    for (i = 1; i <= 5; i++) {
8        if (i == 3)
9            continue;
10        printf("%d ", i);
11    }
12
13    return 0;
14}

Output

1 2 4 5

Explanation

  • When i == 3, printing is skipped
  • Loop continues normally

break vs continue

Featurebreakcontinue
Stops loopYesNo
Skips iterationNoYes
Control goes toOutside loopNext iteration

Goto Statement

3. goto Statement (Not Recommended)

What goto does

  • Jumps to a labeled statement

Example

c
1#include <stdio.h>
2
3int main() {
4    int i = 1;
5
6start:
7    printf("%d ", i);
8    i++;
9
10    if (i <= 3)
11        goto start;
12
13    return 0;
14}

Why goto is discouraged

  • Makes code hard to read
  • Breaks structured programming
  • Avoid in real projects
C Loop Control Statement | C Programming | Learn Syntax