Use break within for loop - C Statement

C examples for Statement:for

Introduction

The break statement causes the loop to exit and executes the statement after for loop.

Demo Code

#include <stdio.h> 
int main()// ww w.jav  a2 s  .  c  o m
{ 
 int x;  
 for ( x = 10; x > 5; x-- ) { 
    if ( x == 7 ) 
      break; 
 }
 printf("\n%d\n", x); 
}

Result


Related Tutorials