Jump statements are used to throw the execution control from one block to another block and these are often used with the control statements (if else, loop, so on)
In C language, there are three jump statements.
1. Break
2. Continue
3. Goto statement
3. Goto statement
THE BREAK JUMP STATEMENT
The break statement is used to exit from a loop from a specific point.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i;
for(i=1; i<=10; i++)
{
printf(“\n %d”,i);
if(i == 5)
{
break;
}
}
getch();
}
PROGRAM EXPLANATION
The above program print only 1-5 counting even the loop terminate condition is 10, because when loop variable counter 5 the break jump statement exist from the loop.
No comments:
Post a Comment