C continue statement

  • continue is a keyword. By using continue, we can skip the statement form loop body.
  • In implementation where we know the maximum number of repetition but some condition is there where we need to skip the statement from the loop body then go for continue.
  • Using continue is always option but it should be placed within the loop body only.

Example1:

void main()
{
int a;
a=0;
while(a<=99) { a+=2; if(a>=40&&a<=80) continue; printf("%d",a); } }

Explanation:
When the continue statement is executed within the loop body then control will pass back to the condition without executing remaining statement.

Example2:

void main()
{
int i;
i=1;
while(i<=79) { i=i+2; if(i>=20&&i<=30) continue; printf("%d",i); } }

Powered by k2schools