Pages

This blog is under construction

Friday, January 4, 2019

Jump statements

Previous
Jumping statements are used to transfer the program’s control from one location to another.

There are four jumping statements in C language:
goto statement
the goto statement unconditionally transfers program control to a labeled statement, where the label identifier is in the scope of the function containing the goto statement. The labeled statement is the next statement executed. 
The goto statement has the following syntax:
         goto identifier;

Flowchart:


return statement

The return statement terminates execution of a function and returns control to the calling function, with or without a return value. A function may contain any number of return statements. The return statement has the following syntax:
·         return expression(opt);



break statement
The break statement terminates execution of the immediately enclosing while , do , for , or switch statement. Control passes to the statement following the loop body (or the compound statement of a switch statement).
The break statement has the following syntax:

break;


Flowchart:

continue statement
The continue statement passes control to the end of the immediately enclosing while , do , or for statement. The continue statement has the following syntax:
continue;

Flowchart:



No comments:

Post a Comment