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
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#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(); }
Syntax:- continueEX
#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