Continue; Continue statement is a jump statement that is used to passes the control to the beginning of the loop. A continue statement transfer the control of execution of the program to pass to the end of the innermost enclosing while, do, or for statement, at which point the loop continuation condition is re-evaluated. It is also be used in switch case statements. Execution of these statement does not cause an exit from the loop but it suspend the execution of the loop for that iteration and transfer control back to the loop for the next iteration.

The syntax is simply:

      continue;

For example,

      statement;
continue;

C Programming code of ‘continue’ statement:

Programming code:

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for(i=1; i<=5; i++)
{
if(i==3)
continue;
printf(“%d\n”,i);
}
getch();
}

Output:

1
2
4
5

In this example the for loop print the value or i from 1 to 5 but skip the print value when the value is equal to 3 but still loop working and continuous print the further values of i.

LEAVE A REPLY

Please enter your comment!
Please enter your name here