break statement in c

The break statement in C programming has the followingtwo usages: When a break statement is encountered inside a loop, the loop is Immediately terminated and the program control resumes at the next Statementfollowing the loop. It can be used to terminate a case in the switch statement . If you are using nested loops, the break statement will stop the execution of the Innermost loop and start executing the next line of code after th block.
The syntax for a break statement in C is as follows: break;

Flow Diagram of Break Statement:

Examples of Break Statement:

#include <stdio.h>
int main()
     int num =0;
        printf("value of variable num is: %d\n", num);
        if (num==2)
     printf("Out of while-loop");
     return 0;

Leave a Comment

Your email address will not be published. Required fields are marked *

// Sticky ads