Break Statement

Written By -

Break statement


Break statement allow us to jump out of the loop and the first statement after loop is executed.

It is also used to terminate a case in switch statement.

The break statement has simple syntax as follows:


Example :

 #include &ltstdio.h>
 int main()
     int a =0;
        printf(“value of a is: %d\n”, a);
        if (a==3)
     printf(“Out of while-loop”);
     return 0;

Output :

   value of a is: 0
   value of a is: 1
   value of a is: 2
   value of a is: 3
   Out of while-loop    

Report Error/ Suggestion

Related Posts:

CopyRight © 2020

CopyRight © 2020