|
|
|
|
Jump Statement C
has four statements that perform an unconditional move (transfer of
control from the point where it is, to a specified statement"). return and goto can be used anywhere in the program, where break and continue statements are used in conjunction with any of the loop statements.
It is used to return from a function. It causes execution to return to the point at which the call to the function was made. The return statement can have a value with it, which it returns to the program from which the function was called.
A goto statements in a program make it difficult to read. They reduce program reliability and make program difficult to maintain. A goto statement transfers control to any other statements within the same function in a C program, but it allows jumps in and out of blocks. #include <stdio.h>
The break statement has two uses. It can be used to terminate a case in the switch statement and/or to force immediate termination of a loop. When a break statement is encountered inside a loop, the loop is immediately terminated and the program control passes to the statement following the loop.it also causes exit from inner loop.
The continue statement causes the next iteration of the enclosing loop to begin. When this statement is encountered in the program, the remaining statements in the body of the loop are skipped and the control is passed to the re-initialization. |