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:
“Most of the folktales dealing with the Indians are lurid and romantic. The story of the Indian lovers who were refused permission to wed and committed suicide is common to many places. Local residents point out cliffs where Indian maidens leaped to their death until it would seem that the first duty of all Indian girls was to jump off cliffs.”
—For the State of Iowa, U.S. public relief program (1935-1943)
“The statements of science are hearsay, reports from a world outside the world we know. What the poet tells us has long been known to us all, and forgotten. His knowledge is of our world, the world we are both doomed and privileged to live in, and it is a knowledge of ourselves, of the human condition, the human predicament.”
—John Hall Wheelock (18861978)