Tagged: break loop

break statement in C 17

break statement in C

break statement in C language is the keyword known to the compiler. The break statement is used to break from any kind of loop. Let us understand the use of break statement using an example. Example: for(i=0;i<10;i++) { /*block of statement*/ } Let us suppose that we want to come out of for loop when the value of i equals to 5. The solution to this is using break statement. The problem can be solved using break statement as follows: for(i=0;i<10;i++) { /*block of statement*/ if(i==5) break; } When the break statement in C is executed the control is transferred...