Every now and then you will want to go back to the top of a loop and do it all again. This happens when you have gone as far down the statements as you need to. C provides the continue statement which says something along the lines of:
Please do not go any further down this time round the loop. Go back to the top of the loop, do all the updating and stuff and go around if you are supposed to.
In the following program the variable Done_All_We_Need_This_Time is set when we have gone as far down the loop as we need to.
for ( item = 1 ; item < Total_Items ; item=item+1 ) { /* item processing stuff */ if (Done_All_We_Need_This_Time) { continue ; } /* additional stuff */ }
The continue causes the program to rerun the loop with the next value of item if it is OK to do so. You can use continue to cause while loops to restart as well. Note how I have laid out the for loop. Sometimes I do this to make the code clearer.