C break statement
The break statement in C language is used to break the execution of loop (while, do while and for) and switch case
In case of inner loops, it terminates the control of inner loop only. There can be two usage of C break keyword:jump-statement; break;
Flowchart of break in c

Example of C break statement with switch case
#include <stdio.h> void main( ) { int i = 2; //initializing a local variable //starting a loop from 2 to 12 for(i = 2; i<= 12; i++) { printf("%d ",i); if(i == 6) { //if value of i is equal to 6, it will break the loop break; } } //end of for loop } Output: 2 3 4 5 6
#include <stdio.h> void main( ) { int i = 2,j = 2; //initializing a local variable for(i = 2; i <= 4; i++) { for(j = 2; j<= 4; j++) { printf("%d%d ", i, j); if(i == 3 && j == 3) { break; //will break loop of j only } } } //end of for loop } Output: 22 23 24 32 33 42 43 44
C continue statement
The continue statement in C language is used to continue the execution of loop (while, do while and for). It is used with if condition within the loop. In case of inner loops, it continues the control of inner loop only.
Syntax:jump-statement; continue;
Example of continue statement in c
#include <stdio.h> void main( ) { int i = 2; //initializing a local variable for(i = 2; i <= 11; i++) { if(i == 6) { //if value of i is equal to 5, it will continue the loop continue; } printf("%d ",i); } //end of for loop } Output: 2 3 4 5 7 8 9 10 11
C continue statement with inner loop
In such case, C continue statement continues only inner loop, but not outer loop.#include <stdio.h> void main( ) { int i = 2, j = 2; //initializing a local variable for(i = 2; i<= 4; i++) { for(j = 2; j <= 4; j++) { if(i == 3 && j == 3) { continue; //will continue loop of j only } printf("%d%d ",i,j); } } //end of for loop } Output: 22 23 24 32 34 42 43 44