C Language / Break and Continue Statements

Break Statement
It is used to jump out of a loop.

Sample Program to print numbers Output

main() {
for (int i = 0; i < 5; i++)
{
if (i == 4) {break;}
Printf(i);
}
}

0
1
2
3

Continue
It is used to skip the loop for once.

Sample Program >Output

main() {
for (int i = 0; i < 5; i++)
{
if (i == 2)
{
continue;
Printf(i);
}
}

0
1
2
3



Home     Back