Goto:
-This statement are used to jump from one line to another line in the program.
-It is the jumping statement in C.
Syntax-
xyz:
goto xyx;
-when the execution of program are come at the goto line then it will jump to the xyz: line.
-Goto statement are also be used to make a loops.
-Goto statement are also goes in infinite loop.
program-
#include < stdio.h>
int main()
{
int i=0;
point:
printf("i=%d\n",i);
i++;
if(i< 4)
goto point;
}
output-
i=0
i=1
i=2
i=3
-In this program, we start with i=0 and print value of i and increase the value of i with 1. and go back to the 'point' and repeat this process until if(i< 4) will become false so that goto statement will not execute.