The continue Statement

·

The keyword continue allows us to take the control to the beginning of the loop bypassing the statements inside the loop which have not yet been executed. When the keyword continue is encountered inside any C loop, control automatically passes to the beginning of the loop.
for e.g:-
main( )
{
int i,j;
for(i = 1; i< = 2; i++)
{
for(j=1; j<=2; j++)
{
if (i= =j)
continue;
printf(“\n%d%d\n”, i,j);
}
}

The output of the above program would be....
12
21
when the value of i equal to 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).

About Me

Blog Archive