‘break’ keyword in C Programming language

2948

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 reached at 2.”);
}

Output:
        1
the value of i reached at 2.

Attempt Free C Programming MCQ Quiz

Previous article‘auto’ keyword of C programming language
Next article‘continue’ keyword in C Programming language
Hello I am Er Parag Verma. I am tech blogger, Professor and Entrepreneur. I am on the mission to change the pattern of learning to make it easy, valuable and advance.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.