1// goto_statement.cpp
2#include <stdio.h>
3int main()
4{
5 int i, j;
6
7 for ( i = 0; i < 10; i++ )
8 {
9 printf_s( "Outer loop executing. i = %d\n", i );
10 for ( j = 0; j < 2; j++ )
11 {
12 printf_s( " Inner loop executing. j = %d\n", j );
13 if ( i == 3 )
14 goto stop;
15 }
16 }
17
18 // This message does not print:
19 printf_s( "Loop exited. i = %d\n", i );
20
21 stop:
22 printf_s( "Jumped to stop. i = %d\n", i );
23}
24