The continue statement is used inside loop. When a continue statement is encountered inside a loop, control jumps to the beginning of the loop for next iteration, skipping the execution of statements inside the body of loop for the current iteration.
The continue statement causes an immediate jump to the top of a loop.
The continue statement brings back program control to the start of the loop. You can use it for both ‘for’ and ‘while’ loops.
The continue statement is exactly opposite to break. The continue statement is used for continuing the next iteration of loop statements.
When it occurs in the loop, it dose not terminate, but it skips current iteration and control is transferred to the next iteration.
Syntax:
continue;
Flow Diagram continue statement:
Example:
#include <stdio.h>
int main()
{
int j=0;
do
{
if (j==7)
{
j++;
continue;
}
printf("%d ", j);
j++;
}while(j<10);
return 0;
}