V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
codechaser
V2EX  ›  C

C 中这样的代码块有什么作用?

  •  
  •   codechaser · Apr 4, 2019 · 3282 views
    This topic created in 2592 days ago, the information mentioned may be changed or developed.
    int main(int argc, char** argv){
    	test : {
        	printf("Test.");
        }
        
        return 0;
    }
    

    这个test是干嘛的?

    5 replies    2019-04-04 22:49:27 +08:00
    andyhuzhill
        1
    andyhuzhill  
       Apr 4, 2019
    标号
    可以使用 goto 跳转到这个个代码块
    cherishxzh
        2
    cherishxzh  
       Apr 4, 2019 via Android
    goto 语录的标签吧
    codechaser
        3
    codechaser  
    OP
       Apr 4, 2019
    @andyhuzhill 谢谢!想起来了!
    codechaser
        4
    codechaser  
    OP
       Apr 4, 2019
    @cherishxzh 谢谢!
    yuikns
        5
    yuikns  
       Apr 4, 2019
    http://cpp.sh/27p4r

    test 是标记开头。

    {} 可以定义局部变量。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2747 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 15:37 · PVG 23:37 · LAX 08:37 · JFK 11:37
    ♥ Do have faith in what you're doing.