The goto statement is used to alter the normal sequence of program instructions by transferring the control to some other portion of the program. The syntax is as follows:
goto label;
Here, label is an identifier that is used to label the statement to which control will be transferred. The targeted statement must be preceded by the unique label followed by colon.
label : statement;
Although goto statement is used to alter the normal sequence of program execution but its usage in the program should be avoided. The most common applications are:
goto can never be used to jump into the loop from outside and it should be preferably used for forward jump.
Situations may arise, however, in which the goto statement can be useful. To the
possible extent, the use of the goto statement should generally be avoided.