In the above syntax, the first line tells the compiler to go to or
jump to the statement marked as a label. Here, the label is a
user-defined identifier that indicates the target statement.
The statement immediately followed after ‘label:’ is the destination
statement.
. The ‘label:’ can also appear before the ‘goto label;’ statement in
the above syntax.
Disadvantages of Using goto Statement
The use of the goto statement is highly discouraged as it makes the
program logic very complex.
The use of goto makes tracing the flow of the program very difficult.
The use of goto makes the task of analyzing and verifying the
correctness of programs (particularly those involving loops) very
difficult.
The use of goto can be simply avoided by using break and continue
statements.
sample code:
Program.c
output:
output.c
Resources :
Featured
Special title treatment
With supporting text below as a natural lead-in to additional content.