C Loop control statement

These are also known as jump statements.
Loop control statement are of three types:

  • break statement
  • continue statement
  • goto

break statement in C

Break statement is usually used to terminate a case in the switch statement.
Break statement in loops to instantly terminates the loop and program control goes to the next statement after the loop.
If break statement is used in nested loops (i.e., loop within another loop), the break statement will end the execution of the inner loop and program control goes back to the outer loop.


continue statement in C 

In the C programming language, the continue statement works slightly similar to the break statement. The continue restarts the loop with the next value of the item. All the line code below continue statement is skipped.

In the for loop, continue statement skips the test condition and increment value of the variable to execute again and In the while and do…while loops, continue skips all the statements and program control goes to at the end of the loop for tests condition.

goto in C

We can jump to any statement inside the same function using goto. To spot the endpoint of the jump a label (tag) is used. goto statement is highly discouraged in any programming language because it makes difficult to trace the control flow of a program, making the program hard to understand and hard to modify.