C break statement

  • Using break keyword, we can terminate loop body or switch body.
  • Using break keyword is always optional, but it should be placed within the loop body or switch body only.
  • In implementation where we know the the maximum number of repetition but some condition is there where we need to terminate the loop body then go for break



void main()
int a;
while(a<=10) { printf("%d",a); if(a>3)

Explanation for above program:

  • Whenever value of a become 4 then condition becomes true, then break statement will be executed.
  • Whenever the break statement is executed automatically control will pass outside of the loop body.
Powered by k2schools