C goto statement is used to jump to a specified label in the code every time, without any condition.
Syntax:
loop/conditions statements
{
statements;
goto;
}
Example:
#include <stdio.h> void main() { int i,n; printf ("Enter a number: "); scanf ("%d",&n); less: printf ("less than 5"); if (i < 5) goto less; else { printf ("%d", i); } } |
Output
Enter a number: 4 less than 5 |