« Previous                                                                  Next Chapter »
Break Statement

Sometimes, it is necessary to exit immediately from a loop as soon as the condition is satisfied. When break statement is used inside a loop, then it can cause to terminate from a loop. The statements after break statement are skipped.

Syntax: break;

Example:
/* program for break statement */
#include<stdio.h>
#include<conio.h>
main()
{
int i;
clrscr();
for(i=0;i<=10;i++)
{
if(i==5)
{
break;
}
printf("%d ",i);
}
}

  « Previous                                                                  Next Chapter »