- The keyword continue allows us to take up the control to the beginning of the loop, bypassing the statements inside the loop, which have not yet been executed.
- When continue is encountered inside any loop, control automatically passes to the beginning of the loop.
- A continue is usually associated with an if.
Let’s consider the following example:
int i, j ;
for ( i = 1 ; i <= 2 ; i++ )
for ( j = 1 ; j <= 2 ; j++ )
if ( i == j )
printf ( “\n%d %d\n”, i, j ) ;
Output of the above program would be…
When the value of i equals that of j, the continue statement takes the control to the for loop (inner) bypassing rest of the statements pending execution in the for loop (inner).