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:
“Oh is that
all? I thot it was something else. Oh
they jump and run too. I wish you had been
there, I was so interested to hear about it.”
—William Carlos Williams (18831963)
“Is it true or false that Belfast is north of London? That the galaxy is the shape of a fried egg? That Beethoven was a drunkard? That Wellington won the battle of Waterloo? There are various degrees and dimensions of success in making statements: the statements fit the facts always more or less loosely, in different ways on different occasions for different intents and purposes.”
—J.L. (John Langshaw)