Break, continue and goto statement in C with tutorial and examples on HTML, CSS, JavaScript, XHTML, Java,.Net, PHP, C, C, Python, JSP, Spring, Bootstrap, jQuery. Continue statement in C language is a loop control statement. This statement forces the next iteration of the loop to take place by skipping any code after this statement. Once the continue statement is executed inside the loop body the control is then transferred to the begining of the loop causing the next iteration to occur.
-->The
continue
statement passes control to the next iteration of the nearest enclosing do
, for
, or while
statement in which it appears, bypassing any remaining statements in the do
, for
, or while
statement body.Syntax
jump-statement:
continue ;
continue ;
The next iteration of a
do
, for
, or while
statement is determined as follows:- Within a
do
or awhile
statement, the next iteration starts by reevaluating the expression of thedo
orwhile
statement. - A
continue
statement in afor
statement causes the loop expression of thefor
statement to be evaluated. Then the compiler reevaluates the conditional expression and, depending on the result, either terminates or iterates the statement body. See The for Statement for more information on thefor
statement and its nonterminals.
This is an example of the
continue
statement:In this example, the statement body is executed while
i
is greater than 0. First f(i)
is assigned to x
; then, if x
is equal to 1, the continue
statement is executed. The rest of the statements in the body are ignored, and execution resumes at the top of the loop with the evaluation of the loop's test.See also
- On
- By
- 0 Comment
- Categories: Continue statements, Keyword in C language
Continue statement in C programming language
Contents
- 1 Continue statement in C programming language
- 1.1 C program continue statement
C program continue statement
We will get to know the uses of Continue statement in C programming language in this tutorial (using for loop and while loop) – it controls the flow of control of loops in C language
Description
![Continue Continue](/uploads/1/1/7/5/117532139/504009409.jpg)
Continue is a keyword in the C language (some time called as a statement because ending with the semicolon)which is used to control the flow of loops.
Typically, this statement can be used inside of the while and for loop.
Break Continue Statement In C++
The continue statement provides the option to skip the current iteration(skip some statements) of the flow of control to the following loops until the flow of control exits the loops.
The syntax of the continue
![Differentiate break and continue statement in c++ Differentiate break and continue statement in c++](/uploads/1/1/7/5/117532139/162771133.png)
Flow diagram of continue
How continue statement works in C – control flow for loop
How to continue statement works in C – control flow – while loop
continue statement in for loop
Program 1
When the above code is compiled and executed, it will produce the following results
When this program is executed, number 5 skipped by continue statement in for loop of C
Program 2
When the above code is compiled and executed, it will produce the following results
Number 20 skipped by continue statements from the addition
Continue statement in while loop in C
Program 3
Purpose Of Continue Statement In C++
When the above code is compiled and executed, it will produce the following results
When this program is executed, number 6 skipped the continue statement in for loop
Program 4
When the above code is compiled and executed, it will produce the following results
When this program is executed, number 25 is skipped from calculating total by continue statement in for loop
Suggested for you