Home > Electronics Tutorials > C Language Tutorial > Statements - break

C Language Programming Library Reference Guide

Statements - break

The break statement can only appear in a switch body or a loop body. It causes the execution of the current enclosing switch or loop body to terminate.

Syntax:

break; Examples:
switch(henry)
 {
 case 1: print("Hi!\n");
         break;
 case 2: break;
 }
If henry is equal to 2, nothing happens.
for(loop=0;loop<50;loop++)
 {
  if(loop==10)
    break;
  printf("%i\n",loop);
 }
Only numbers 0 through 9 are printed.
Note: To report broken links or to submit your projects, tutorials please email to Webmaster

Discover

     more......