goto statement in C

By | January 10, 2015

goto statement in C

By using goto statement you can transfer the control of program anywhere. This keyword is not recommended to use in any situation. 


goto label;
. . . . 
. . . . 
label: statement;

Flowchart of goto statement in C
Flowchart of goto statement in C – Image Source

Lets make one program to understand it.


goto statement in C

Why you should avoid goto statement in C?
It takes the control of the program anywhere and anytime which is not good for software development life cycle. In this cycle a program has to debug and re-test a lot of times. And with the use of goto keyword it makes very hard to debug the program.

This keyword is generally used to take the control outside the loop. That’s it. Otherwise you should avoid this keyword.

Leave a Reply

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