Day 3 Jump statements: go-to Statement in C Programming language
Jump Statement # go to statement
goto statement is a jump statements. Goto is used for jumping from one point to another point in your function. You can not jump from one function to another. Jump points or way points for goto are marked by label statements. Label statement can be anywhere in the function above or below the goto statement.
Syntax
.
goto label1;
.
.
label1 :
.
.
label2 :
.
.
goto label2;
Example
#include <stdio.h>
int main (void) // Print value 0 to 9
{
a = 1;
loop:; // label stament
printf ("\n%d",a);
a++;
if (a < 10)
goto loop ; // jump statement
retrun 0;
}