C continue statement

Description

continue statement breaks the current iteration.

Syntax

continue statement has the following syntax.

continue;

Example

The following code uses continue statement to exit current iteration.


#include<stdio.h>
/*from w  w  w  .java  2  s . c o  m*/
main(){
    int i;
    for(i = 0; i < 11; i++){
       if ((i == 4) || (i == 7)) {
          continue;
       }
       printf(" the value of i is %d\n", i);
    }
}

The code above generates the following result.

From the output we can see that the value 4 and 7 are not printed.





















Home »
  C Language »
    Language Basics »




C Language Basics
Data Types
Operator
Statement
Array