C Continue Statement

The continue statement is used to skip the current iteration of a loop and move directly to the next iteration. It does not exit the loop completely, but rather skips the remaining code in the current iteration and jumps back to the loop’s condition for the next iteration.

Syntax:


continue;

Note: It is typically used when a certain condition is met, and you want to skip the current iteration without exiting the loop.

Example:


#include <stdio.h>

int main() {
    for (int i = 1; i <= 5; i++) {
        if (i == 4) {
            continue;  // Skip the rest of the loop when i is 4
        }
        printf("%d\n", i);
    }
    
    return 0;
}

Output:

1
2
3
5

C Continue Statement – Interview Questions

Q 1: What is the continue statement in C?
Ans: It skips the current iteration of a loop and continues with the next iteration.
Q 2: Where can continue be used?
Ans: Only inside loops (for, while, do-while).
Q 3: What is the difference between break and continue?
Ans: break exits the loop; continue skips the current iteration.
Q 4: Does continue work in switch statements?
Ans: No, it works only in loops.
Q 5: Why use continue in loops?
Ans: To skip unwanted iterations without stopping the loop

C Continue Statement – Objective Questions (MCQs)

Q1. What does the continue statement do in C?






Q2. Which of the following best describes where continue can be used?






Q3. What will be the output of this code?

for (int i = 1; i <= 5; i++) {
if (i == 3)
continue;
printf("%d ", i);
}






Q4. What happens when a continue statement is encountered in a while loop?






Q5. What is the difference between break and continue?






Related C Continue Statement Topics