C --goto跳转语句

#include <iostream>
using namespace std;

void func(bool b) {
    if (b==true){
        goto label;
    }
    else {
        goto label1;
    }
label:
    cout << "" << endl;
    return;
label1:
    cout << "" << endl;
    return;
}

int main()
{
    /*
    goto语句:可以让CPU跳转到任何一条语句去执行
    语法:goto 标签
    */
    func(1);
    return 0;
}

 

 

 

posted @ 2020-08-12 07:50  天子骄龙  阅读(253)  评论(0编辑  收藏  举报