Why use of goto…label is not recommended in C programming
Why use of goto…label is not recommended for unconditional
jumps ?
The labelled statement is searched from the very
first line of code till the last line of code by the compiler using linear
search mechanism. If the labelled statement is found, then the control is
transferred to this statement from the goto statement, otherwise a compile time
error is reported. The computational overhead is hire as compared to a
conditional jump operation due to this linear search mechanism.
Use of goto…label may result an indefinite iteration between the goto statement and the labelled statement. That resulting a sentinel or infinite loop in the program. Thus use of goto…label is not recommended in a C program.
No comments