Break;

Break keyword in C programming language uses to passes control program execution out of the compound statement.

The break statement is a jump instruction or a program execution control switching keyword that can be used innermost enclosing a switch construct, for loop, while loop and do-while loop. The execution of break statement causes immediate exit from the concern construct and the control is transferred to the statement following the loop. In the loop construct the execution of break statement terminates loop and further execution of the program is reserved with the statement following the body of the loop.

The syntax is simply ‘break’ keyword:

       break;

Example:

       statement;
break;

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for(i=1;i<=10;i++)
{
if(i==2)
break;
printf(“%d\n”,i);
}
printf(“the value of  i reach at 2.”);
}

Output:
        1
the value of  i reach at 2.

LEAVE A REPLY

Please enter your comment!
Please enter your name here