The Break statement is used to bring the program control out of the loop. The break statement is used inside loops or switch statement.
The break statement in C can be used in the following two scenarios:
- With switch case
- With loop
//loop or switch case
Example - break statement
The continue statement in C language is used to bring the program control to the beginning of the loop. It is mainly used for a condition so that we can skip some code for a particular condition.
//some lines of the code which is to be skipped
Example - continue statement
Break and Continue in While Loop
You can also use break and continue in while loops: