The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C Break Statement

break statement

Why Break Statement?

Though break statement comes under decision-making statement, its most oftenly using in looping. One can use the break statement to break out from a loop or switch statement. When break is executed within a loop, the loop ends immediately, and execution continues with the first statement following the loop.

C Break Statement

  • The word break is a keyword that terminates the execution of the loop or the control statement and the control is transferred to the statement immediately following it.
  • The break statement is mostly used in switch control statement.

Break Statement Flowchart

The following flowchart will clearly demonstrate how break statement works

break statement flowchart

Break Statement Program

Let us write a C program to demonstrate break statement.

break.c
#include <stdio.h> //header file section
int main()
{
int a;
for(a = 1;a <= 5;a++)
{
if(a == 4)
{
break;
}
printf("%d ", a);
}
return 0;
}
  • 1 2 3

Note:

The loop will be terminated immediately, when a variable a = 4 is encountered.

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report