goto name;
. . .
name: statement
The goto keyword transfers control directly to the statement specified by the label name.
For related information, see if, return, and switch.
Example
In this example, a goto statement transfers control to the point labeled stop
when i
equals 5.
// Example of the goto statement
void main()
{
int i, j;
for ( i = 0; i < 10; i++ )
{
printf( "Outer loop executing. i = %d\n", i );
for ( j = 0; j < 3; j++ )
{
printf( " Inner loop executing. j = %d\n", j );
if ( i == 5 )
goto stop;
}
}
/* This message does not print: */
printf( "Loop exited. i = %d\n", i );
stop: printf( "Jumped to stop. i = %d\n", i );
}