Break and Continue Statement: Infinite Loop Situation

What's the difference between break and continue statement? How will it help the infinite loop situation?

© SolutionLibrary Inc. 9836dcf9d7

Solution Preview

...nes inside the loop.

int i;
for (i=0;i<5i++)
if (i==1)
if (i==3)

This code will print 0, 2, 3, But 1 will not be printed.

In the above code, the break statement is not letting the i value to reach 4, as when the i reaches 3 the second 'if' condition makes the 'for' loop exit.

When the i becomes 1, the continue statement makes the rest of the statement from the ...