What is the purpose of the ‘continue’ statement in a loop?

What is the purpose of the ‘continue’ statement in a loop?

a) To exit the loop immediately
b) To skip the current iteration and continue with the next one
c) To break out of the loop
d) To start the loop again from the beginning

Answer:

b) To skip the current iteration and continue with the next one

Explanation:

The continue statement in C is used within loops to skip the remaining code in the current iteration and move directly to the next iteration. It is particularly useful when you need to skip certain conditions without terminating the loop entirely. For example, in a loop that processes numbers, you might use continue to skip processing of negative numbers.

Understanding the continue statement is important for controlling the flow of loops efficiently in C programming.

Reference links:

https://www.rameshfadatare.com/learn-c-programming/

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top