C Programming • C Basics, Operators, Loops
C Programming / Unconditional control statements: continue

Unconditional control statements: continue

Notes 2 C Basics, Operators, Loops

Definition: The continue statement is used to skip the remaining statements of the current iteration of a loop and move directly to the next iteration.

Notes

continue Statement in C

Definition: The continue statement is used to skip the remaining statements of the current iteration of a loop and move directly to the next iteration.

💡 Example: If a loop is printing numbers from 1 to 5 and continue is used when i == 3, the number 3 is skipped but the loop continues with 4 and 5.

Syntax

continue;

How continue Works

Loop starts ↓ Condition checked ↓ Execute statements ↓ continue encountered? ↓ ↓ Yes No ↓ ↓ Skip remaining statements ↓ Next iteration

Example

In the following program, the value 3 is skipped using the continue statement.

#include <stdio.h>

int main()
{
    int i;

    for (i = 1; i <= 5; i++)
    {
        if (i == 3)
            continue;           // skip the current iteration

        printf("%d ", i);
    }

    return 0;
}

Output

1 2 4 5

Why is continue Used?

The continue statement is used when a particular iteration should be skipped but the loop should continue executing the remaining iterations.

💡 Example: While processing student records, a program may skip a record that does not satisfy a particular condition and continue with the next student.

continue with for Loop

When continue is used inside a for loop, the remaining statements of the current iteration are skipped. Control then moves to the update expression before the next condition check.

💡 Example: In a loop from 1 to 10, if continue is executed when i == 5, the statements after continue are skipped for 5, but the loop continues with 6.

continue with while Loop

The continue statement can also be used inside a while loop to skip the current iteration and proceed with the next condition check.

💡 Example: A program reading several values can skip unwanted values and continue processing the remaining input.

Practical Example — Skip Even Numbers

Problem Statement

Write a C program to print numbers from 1 to 10 while skipping all even numbers using the continue statement.

Learning Outcomes

  • Understand the purpose of the continue statement.
  • Skip a particular iteration without terminating the loop.
  • Use continue with a conditional statement.

Hint

Use a for loop from 1 to 10. If the number is divisible by 2, use continue to skip that iteration.

Theory

The continue statement skips the remaining statements of the current loop iteration. Unlike break, it does not terminate the loop.

Program

#include <stdio.h>

int main()
{
    int i;

    for (i = 1; i <= 10; i++)
    {
        if (i % 2 == 0)          // check for even number
            continue;             // skip even numbers

        printf("%d ", i);
    }

    return 0;
}

Expected Output

1 3 5 7 9

Note

The continue statement does not exit the loop. It only skips the current iteration. The loop continues with the next iteration.

break vs continue

break continue
Terminates the loop completely. Skips only the current iteration.
Control moves outside the loop. Control moves to the next iteration.
Remaining iterations are not executed. Remaining iterations continue normally.
Used when the loop must stop. Used when one iteration must be skipped.

Important Points for Exam

  • continue skips the current iteration.
  • It does not terminate the loop completely.
  • It can be used inside for, while and do-while loops.
  • In a for loop, control moves to the update expression after continue.
  • continue is different from break.
🎯 Easy Rule:

continue = Skip this iteration, continue the loop

Quick Revision

Concept Remember
Purpose Skip the current iteration.
Syntax continue;
Loop status Loop continues.
Difference from break break exits; continue skips.

Important Exam Questions

Short Answer Questions

  1. What is a continue statement in C?
  2. Write the syntax of continue.
  3. What happens when continue is executed inside a loop?
  4. Does continue terminate a loop?
  5. Where can the continue statement be used?
  6. Differentiate between break and continue.

Long Answer Questions

  1. Explain the continue statement with syntax and suitable example.
  2. Write a C program to print numbers from 1 to 10 while skipping even numbers using continue.
  3. Explain the difference between break and continue with examples.
🎥 Recommended Learning

Watch a beginner-friendly explanation of the continue statement in C programming.

▶ Watch: continue Statement in C — Hindi

📝 Handwritten Notes

A short handwritten-style revision sheet for the continue statement will be provided here.

🧠 Mind Map

Use the mind map for quick revision of continue, skipped iterations and loop continuation.