TopBottom

Followers



Click on more
SUBSCRIBE

Enter your email address:

Delivered by FeedBurner



VIDEO

Announcement: wanna exchange links? contact me at ravikrak@yahoo.com

GOTO Statment in C lang

Posted by Ravi Kumar at Wednesday, August 31, 2011
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

This Keyword is used when we want to transfer the control
to some point in the program which is not in the normal, step
by step sequence of a program.

It takes control from one place to another unconditionally, So a different path for the execution of a program to
set up.
The following program illustrates the use of a GOTO.

Example:

main()
{
printf("Hope is hoping against hope. . . . . . ");
goto here;
printf("Even it seems hopeless");
hope();
exit(0);
}

OUTPUT:
Hope is hoping against hope. . . . . .

Explanation:
The second part of the message will not get printed,
as due to goto, control skips to the label hope and
execution is terminated due to exit(0) present here.After
hope, those would have got executed.

Though goto seems to be handing over to us a magic
word for placing control where are please, we would do
well to empty combinations of IF, For,while and switch
instead.This is because goto makes the program less readable and hard to debug. Besides,once the control is given
to goto, there no telling how the program would behave, as
is illustrated.

Share |

Labels:

0 comments:

Post a Comment