C/C++ Break Statement

Break Statement IN C /C++

in C/C++ break statement is used to terminate the loops execution , switch case execution from the subsequent execution.
Syntax of Break Statement
break ;
Example 1:

int main()
int i;

for(i=1 ;i<=10 ; i++)


if (i==5)


printf(" \n %d",i);


return 0;

In above example if we not use break statement then its display the number 1 to 10 but as we put the break statement in the body of loop after the IF statement which check the value of i if 1=5 then its execute the break statement other wise its execute the printf statement. When i assigned the value 5 then break statement execute and control is transfer outside the loop structure with checking the next value of i.