Image

C Language - Control Statements - Jumps Statement

Break statement

break statement

Only it use in loop or switch. It is a keyword of C language, it is used to terminate currently executing looping statement . It is allowed within looping and switch statement . It is also called as jump statement.

Syntax
               break;
EX: WAP for break keywords
#include<stdio.h>
#include<conio.h>
void main()
  {
     int i;
     clrscr();
     for(i=1;i<=10;i++)
     {
     if(i==5)
      break;
      printf("\n %d",i);
     }
     getch();
  }
o/p
1
2
3
4

goto statement
It is a keyword of C language it is used to jump from one statement to another statement within same code. It is also called as jump statement .
Syntax:                goto  label
                              :
			      :
		     Label: statement;

Here label can be any plain text except C keyword and it can be set any where In the C program above or below to goto statement.

Flowchart

EX: WAP for goto statement
#include<stdio.h>
#include<conio.h>
main()
 {
	 int a,b,c;
	 clrscr();
	 printf("\n Enter value of a& b");
	 scanf("%d%d",&a,&b);
	 if(b==0)
		goto error;
		c=a/b;
		printf("\n Answer =%d",c);
	 if(b==0)
		error:printf("\n try todivide by zero number");
	 getch();
 }

continue
It is a keyword of C language it is used to continue currently executing looping statement . It is only used within looping statement. It is also called as jump statement .
Syntax:-    continue
EX
#include<stdio.h>
#include<conio.h>
void main()
{
 int i;
 clrscr();
 for(i=1;i<=10;i++)
 {
 if(i==5)
 continue;
 printf("\n %d",i);
 }
 getch();
}
o/p
1
2
3
4
5
6
7
8
9
10