What Is Goto in C Language
The Goto Statement Is a Jump Statement Which Is Sometimes Also Referred to as Unconditional Jump Statement. the Goto Statement Can Be Used to Jump from...
The goto statement is a jump statement which is sometimes also referred to as unconditional jump statement. The goto statement can be used to jump from anywhere to anywhere within a function.
What is the use of goto?
The goto statement can be used to alter the flow of control in a program. Although the goto statement can be used to create loops with finite repetition times, use of other loop structures such as for, while, and do while is recommended. The use of the goto statement requires a label to be defined in the program.
Must Read
Why goto in C is bad?
Using a goto to jump out of a deeply-nested loop can often be cleaner than using a condition variable and checking it on every level. Using goto to implement subroutines is the main way it is abused. This creates so-called “spaghetti code” that is unnecessarily difficult to read and maintain.