반응형

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
int main()
{
 
    int a = 0;
 
    while (1) {
        printf("hello");
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (a == 0)
                    goto stop;
            }
        }
    }
    stop:
    printf("탈출\n");
    return 0;
}
 
cs

 

// goto 문이 실행되는 순간 stop:구문으로 이동하여 탈출 한다.

출력 결과  :

 

 

반응형

+ Recent posts