Goto Statement

  • Basically, we can say it Local Goto because the visibility is within the loop or function.
  • Goto statement; we can use it as forward jump and also for backward jump.
  • While working with Goto we need to observe two main things: 1. Setting a label and 2. Calling the label.
  • It can be used within the function, we can’t use Goto to jump from one function to another.
  • Non – local Goto is used in LINUX for a jump from one function to another function.
  1. Backward call :

Untitled Diagram (15).jpg

2. Forward call :

Untitled Diagram (16).jpg

 

  • Label name shouldn’t be a Keyword i.e int, char & constant also i.e. goto 10;  goto 11 etc.
  • Only variable is allowed i.e. goto a, goto i etc.
  • After labelling goto, at – least one statement should be there otherwise it will give an error.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: