Jump Statements
Jump statements transfer control unconditionally. There are four types of jump statements in C: goto, continue, break, and return.
The goto statement looks like this:
gotoThe identifier must be a label (followed by a colon) located in the current function. Control transfers to the labeled statement.
A continue statement may appear only within an iteration statement and causes control to pass to the loop-continuation portion of the innermost enclosing iteration statement. That is, within each of the statements
while (expression) { /* ... */ cont: ; } do { /* ... */ cont: ; } while (expression); for (expr1; expr2; expr3) { /* ... */ cont: ; }a continue not contained within a nested iteration statement is the same as goto cont.
The break statement is used to end a for loop, while loop, do loop, or switch statement. Control passes to the statement following the terminated statement.
A function returns to its caller by the return statement. When return is followed by an expression, the value is returned to the caller as the value of the function. Encountering the end of the function is equivalent to a return with no expression. In that case, if the function is declared as returning a value and the caller tries to use the returned value, the result is undefined.
Read more about this topic: C Syntax, Control Structures
Famous quotes containing the words jump and/or statements:
“If my head hurt a hairs foot
Pack back the downed bone. If the unpricked ball of my breath
Bump on a spout let the bubbles jump out....”
—Dylan Thomas (19141953)
“We assume that politicians are without honor. We read their statements trying to crack the code. The scandals of their politics: not so much that men in high places lie, only that they do so with such indifference, so endlessly, still expecting to be believed. We are accustomed to the contempt inherent in the political lie.”
—Adrienne Rich (b. 1929)