The continue statement can be used to skip the rest of the body of an iterative loop. The use of a continue statement violates the rules of structured programming, however, and a section of code which uses a continue statement can always be rewritten to omit the continue.
The continue statement can be used to skip the rest of the body of an iterative loop.
1 is an odd number. +`3 is an odd number. +`5 is an odd number. +`7 is an odd number. +`9 is an odd number. +`item`* Topic`See Also columns
| MSDN | The C continue Statement | Visual Studio 9.0 (2008), .NET 3.5 |
| MSDN | The C continue Statement | Visual Studio 8.5, .NET 3.0 |
| MSDN | The C continue Statement | Visual Studio 8.0 (2005), .NET 2.0 |
| MSDN | The C continue Statement | Visual Studio 7.1 (2003), .NET 1.1 |
| MSDN | The C continue Statement | Visual Studio 6.0 |
#include <stdio.h>
#include <stdlib.h>
int main () {
unsigned x;
x = 0;
while (x < 10) {
++x;
if (x % 2 == 0) {
continue;
}
printf ("%i is an odd number.\n", x);
}
return 0;
}
| break Statement | <break-statement> |
|
C Now
| C continue Statement |
| C++ Now | C++ continue Statement |