首页 > 其他 > 详细

[C]goto statement, rarely been used. Deprecated???

时间:2020-06-06 10:46:32      阅读:42      评论:0      收藏:0      [点我收藏+]

 

#include <stdio.h>
int main()
{
    int a = 0;
    while (a < 10){
        printf("a is %d\n", a);
        if ( a == 5)
            goto OUT;
        a++;
    }
    OUT:
        printf("We‘re out of the loop.\n");
    return 0;
}

 

运行结果为:

a is 0
a is 1
a is 2
a is 3
a is 4
a is 5
Were out of the loop.

 

[C]goto statement, rarely been used. Deprecated???

原文:https://www.cnblogs.com/profesor/p/13053344.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!