Break Statement in C - c break

Learn c - c tutorial - Break Statement in C - c examples - c programs
Break Statement in C
- The loop is immediately terminated and the program control resumes at the next statement following the loop is known as Break statement is encountered within a loop.
- It is used to terminate a case in the switch statement.

Learn c - c tutorial - Break Statement in C - c examples - c programs
Sample Code
#include <stdio.h>
int main()
{
int loop; //loop counter
for(loop=1; loop<=10; loop++)
{
if(loop==7)
{
printf("break...\n");
break;
}
printf("%d\n",loop);
}
printf("BYE BYE!!!\n");
return 0;
}
Output
1
2
3
4
5
6