‘continue’ keyword in C Programming language

2266

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

Previous article‘break’ keyword in C Programming language
Next articleToward high level language: Definition, Example and Benefits of HLL
Er Parag Verma
Hello I am Er Parag Verma. I am tech blogger, Professor and Entrepreneur. I am on the mission to change the pattern of learning to make it easy, valuable and advance.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.