break Statement in C

In this tutorial, you learn about the break statement in C and Also we discuss use of break statement in C with the help of the example.

break Statement in C

When we have to leave the loop immediately in the C program then break helps to achieve this target. When the break statement is encountered then it immediately leaves the loop and continues with the rest of the statements. When the break statement encountered with a switch case statement then it blocks the remaining cases and comes out from the switch statement. 


In the upcoming tutorial, I shared the difference between break and continue statements. we also use break statement with a while loop, for loop, and switch case statement.


C break statement

Syntax of break Statement 

The syntax of break statement as follows 

break;

break Statement Flowchart

The flowchart of break statement as follows 

break Statement in C
break in C

Program: 


The C break statement example as follows

#include<stdio.h>
int main()
{
 int n, i; 
 scanf("%d",&n);
 for(i=0; i<n; i++)
 {
  printf("%d\n",n);
  n++;
  if(n%10==0)
  {
   printf("Now break encountered \n");
   break;
  }
 }
 printf("Coming out");
}

Program Output:


10
10
11
12
13
14
15
16
17
18
19
Now break encountered
Coming out

We learned break statement in C
 and Also we discuss the use of break statement in C with the help of the example. Give your valuable comment.

Happy Coding 😊

If you have any doubts, Please let me know

Previous Post Next Post

Contact Form