Question: Executing a continue statement in C causes the program to jump to the end of the current loop iteration. The stated rule for translating a
Executing a continue statement in C causes the program to jump to the end of the current loop iteration. The stated rule for translating a for loop into a while loop needs some refinement when dealing with continue statements. For example, consider the following code:

A. What would we get if we naively applied our rule for translating the for loop into a while loop? What would be wrong with this code?
B. How could you replace the continue statement with a goto statement to ensure that the while loop correctly duplicates the behavior of the for loop?
/* Example of for loop containing a continue statement */ /* Sum even numbers between 0 and 9 */ long sum= 0; long i; for (i = 0; 1
Step by Step Solution
3.50 Rating (147 Votes )
There are 3 Steps involved in it
Our stated rule for translating a for loop into a while loop is j... View full answer
Get step-by-step solutions from verified subject matter experts
