continue statement in C programming language

The continue statement is used in C program to skips some lines of code inside the loop and continues with the next iteration. It is mainly used for a condition so that we can skip some code for a particular condition.

The syntax for a continue statement in C is :
continue;

Example :
#include<stdio.h> 
int main()
{
      int i;
      for(i=1;i<=10;i++)
      {     
            if(i==5) // skip the iteration when i is equal to 5
            {
                  continue;
            }
      printf("%d \n",i);
      }
      return 0;
}

Output :
1
2
3
4
6
7
8
9
10

0 Comments