Does anyone have any good coding examples which use a continue statement. I'm fairly new to C programming and am unfamiliar with continue statements.
What is the purpose of a continue statement?
Collapse
X
-
Definition:The continue statement in C programming forces the next iteration of the loop to take place, skipping any code in between.
Here is also a simple example:
If you run it you will notice that the 3 number is not printed because we have made a condition that if i = 3 then it skips this i and moves to the next i and it prints it.
Code:#include <stdio.h> int main(){ int i; for (i=0;i<=9;i++){ if (i == 3){ continue; }else{ printf("%d\n",i); } } }
Comment