Home » C continue statement

C continue statement

by Online Tutorials Library

C continue statement

The continue statement in C language is used to bring the program control to the beginning of the loop. The continue statement 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.

Syntax:

Continue statement example 1

Output

infinite loop 

Continue statement example 2

Output

1 2 3 4 6 7 8 9 10 

As you can see, 5 is not printed on the console because loop is continued at i==5.

C continue statement with inner loop

In such case, C continue statement continues only inner loop, but not outer loop.

Output

1 1 1 2 1 3 2 1 2 3 3 1 3 2 3 3 

As you can see, 2 2 is not printed on the console because inner loop is continued at i==2 and j==2.


Next TopicC goto statement

You may also like