Easy Tutorial
❮ C Exercise Example1 C Exercise Example29 ❯

C continue Statement

C Loops

The continue statement in C is somewhat similar to the break statement. However, instead of forcing termination, continue skips the current iteration of the loop and forces the next iteration of the loop.

For for loops, the increment statement still executes after the continue statement. For while and do...while loops, the continue statement re-evaluates the condition.

Syntax

The syntax for the continue statement in C:

continue;

Flowchart

Example

Example

#include <stdio.h>

int main ()
{
   /* Local variable definition */
   int a = 10;

   /* do loop execution */
   do
   {
      if( a == 15)
      {
         /* Skip the iteration */
         a = a + 1;
         continue;
      }
      printf("Value of a: %d\n", a);
      a++;

   }while( a < 20 );

   return 0;
}

When the above code is compiled and executed, it produces the following result:

Value of a: 10
Value of a: 11
Value of a: 12
Value of a: 13
Value of a: 14
Value of a: 16
Value of a: 17
Value of a: 18
Value of a: 19

C Loops

❮ C Exercise Example1 C Exercise Example29 ❯