TutorialStudyMite
Break Statement
Sstudymite1 min read
Beginner friendly
Track completion, mastery, and revision.
Break statement
Break statement allow us to jump out of the loop and the first statement after loop is executed.
It is also used to terminate a case in switch statement.
The break statement has simple syntax as follows:
break;
Example :
#include <stdio.h>
int main()
{
int a =0;
while(a<=10)
{
printf(“value of a is: %d\n”, a);
if (a==3)
{
break;
}
a++;
}
printf(“Out of while-loop”);
return 0;
}
Output :
value of a is: 0 value of a is: 1 value of a is: 2 value of a is: 3 Out of while-loop
Finished reading?