In C, the break and continue statements are used to alter the flow of control within loops (such as for and while loops) and switch statements.

break Statement:

The break statement is used to exit a loop or a switch statement prematurely. It is often used to terminate the loop or switch when a certain condition is met.

Reached the condition. Breaking out of the loop.

In this example, the loop will terminate when i becomes 5.


continue Statement:

The continue statement is used to skip the rest of the code inside a loop for the current iteration and move to the next iteration of the loop.

In this example, when i is 3, the continue statement will skip the printf statement and move to the next iteration of the loop.

Both break and continue statements provide a way to control the flow of a loop based on certain conditions, making your code more flexible and efficient.