Jump statements

-> Goto [Avoided in normal programming.]

-> Continue

-> Break

-> Return

 

Syntax are as follows:

-Goto:

Only statement2 will be executed and statement 1 won’t be executed as the programs makes a jump to label.

 

-Continue:

Example:

 

In this loop statement1 gets executed and statement2 will not be executed!

Continue statement after statement1 takes the control back to the decision making

i.e., foor loop here, and hence it skips the statement2 in each execution till n.

 

-Break:

Eg:

while(condition)

{

printf(“hi”);

break;

printf(“hello”)

}

 

This program prints hi and won’t print hello because before it moves to the

statement which prints hello break is encountered which beings the control out of the while loop and hence only hi is printed.

 

-Return:

return(value)

Eg:

main()

{

return(0)

}

It returns 0 to the main function.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *