What is Continue Statement in C?

Continue statement is a Keyword and we use continue statement inside the loops only.

Why we use Continue statement. ?

If you want to skip the current iteration of the loop and want to begin the next iteration then we use continue statement.

Syntax:

	
    continue;
    

Example of continue statement:


	#include<stdio.h>
	#include<conio.h>

	void main()
	{
		int i;
		clrscr();

		for(i=1; i<=10; i++)
		{
			if(i==5)
			{
			continue;
			}
			printf("%d\n",i);
		}

		getch();
	}

Output

	
    1
    2
    3
    4
    6
    7
    8
    9
    10
    

Now understand the working of the program

In above example we are skipping the iteration number 5 with the help of continue statement. This is the use of continue statement.

Previous for loop condition Next Break Statement

Advertisement here

Share this Page.

Post Your Comment