Continue Statement in C/C++ Programming


In this tutorial, we will be discussing a program to understand continue statement in C/C++.

Continue statement is a loop control statement which rather than breaking through the loop like the break statement, forces the current pointer to move to the next iteration of the loop without implementing the rest statements in the current iteration.

Example

 Live Demo

#include <stdio.h>
int main() {
   //looping from 1 to 10
   for (int i = 1; i <= 10; i++) {
      //skipping printing of 6
      if (i == 6)
         continue;
      else
         printf("%d ", i);
   }
   return 0;
}

Output

1 2 3 4 5 7 8 9 10

Updated on: 12-Mar-2020

142 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements