Continue;
Continue statement is a jump statement that is used to pass the control to the beginning of the loop. A continue statement transfer the control of execution of the program to pass to the end of the innermost enclosing while, do, or for statement, at which point the loop continuation condition is re-evaluated. It is also used in switch case statements. Execution of these statement does not cause an exit from the loop but it suspends the execution of the loop for that iteration and transfer control back to the loop for the next iteration.
The syntax is simply:
continue;
For example,
statement;
continue;
C Programming code of ‘continue’ statement:
Programming code:
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for(i=1; i<=5; i++)
{
if(i==3)
continue;
printf(“%d\n”,i);
}
getch();
}
Output:
1
2
4
5
Also read: Break Keyword in C Programming
In this example the for loop print the value of i from 1 to 5 but skip the print value when the value is equal to 3 but the still loop works and continuously print the further values of i.
Attempt Free C Programming MCQ Quiz