< Prev
Next >

Continue Statement

In C language, we may use continue statement within a loop and when a continue statement is encountered in a loop of a program in execution, it skips executing the rest of statements in the loop for that particular iteration and the program continues with the next iteration and condition checking in the loop.

Continue statement example

/* C - continue statement example */


int main() /*main method and program begins here */

for(int i=0;i<5;i++)

	printf("i = %d \n", i);

printf("Out of the loop");

return 0;
} /* main method ends and so does the program */


i = 0
i = 1
i = 3
i = 4
Out of the loop

As you may see in the output of the program, when continue statement was encountered within an executing for loop, it skipped executing the printf() statement in the loop for that particular iteration i.e. when i is equal to 2. The program continued normally with the next iteration(i is equal to 3) and condition checking.

Please share this article -

Facebook Google Pinterest Reddit Tumblr Twitter

< Prev
Next >
< Switch Statement
Goto Statement>
Please subscribe our social media channels for notifications, we post a new article everyday.

Decodejava Google+ Page Decodejava Facebook Page  DecodeJava Twitter Page

Coming Next
C++ and Python