How does the continue
statement work in C?
a) Skips the current iteration of a loop
b) Stops the loop
c) Exits the loop
d) None of the above
Answer:
a) Skips the current iteration of a loop
Explanation:
The continue
statement in C is used within loops to skip the rest of the code inside the loop for the current iteration and jump to the next iteration. When continue
is encountered, the loop condition is re-evaluated to decide whether to proceed with the next iteration.
This is particularly useful when certain conditions are met, and you want to skip over some code without exiting the loop altogether, allowing for more precise control over loop execution.