Table of Contents
show
When the break statement present inside a loop is executed, it terminates the loop and the program control is transferred to the statement present next to the loop
Syntax
break;
Example
#include <stdio.h>
int main()
{
int var;
for (var =100; var>=10; var --)
{
printf("var: %d\n", var);
if (var==99)
{
break;
}
}
printf("Out of for-loop");
return 0;
}
Output
var: 100
var: 99
Out of for-loop
Views: 0