CHAPTER 14 / 26
C Break & Continue
Learn how break and continue control loop execution.
01 — Syntax
break;\ncontinue;
02 — Example
#include <stdio.h>
int main() {
for (int i = 1; i <= 10; i++) {
if (i == 6) break;
printf("%d ", i);
}
return 0;
}03 — Important Points
- break exits the loop.
- continue skips to the next iteration.
04 — Common Mistakes
- Using continue when break was intended.
- Creating a loop that never terminates.
05 — Real-World Use
Break and continue are useful for controlling search and filtering loops.
06 — Practice
Create a small program that demonstrates the main idea of C Break & Continue.