Explain the Goto Statement - Computer Programming?
The goto statement is employed to alter the normal sequence of program execution by transferring control to some other part of the program. It can be written like
goto label1;
...............
...............
label1: ...............
Where label is an identifier specifically uses to locate target statement to which control is transferred the label must be in the same function as the goto statement that uses it. You can't jump between functions and the lable must be followed by a colon, label can occur before or after goto and no two statements can have the same label.
For illustration: To print the numbers up to 100 using goto statement.
x=0;
loop :
printf("Value of x = %d\n",x);
x++;
if (x<=100) goto loop;