codechaser
V2EX  ›  C

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

  •  
  •   codechaser · Apr 4, 2019 · 3694 views
    This topic created in 2769 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
    andyhuzhill
    Apr 4, 2019
    1
    标号
    可以使用 goto 跳转到这个个代码块
    cherishxzh
    cherishxzh
    Apr 4, 2019 via Android
    2
    goto 语录的标签吧
    codechaser
    codechaser
    OP
    Apr 4, 2019
    3
    @andyhuzhill 谢谢!想起来了!
    codechaser
    codechaser
    OP
    Apr 4, 2019
    4
    @cherishxzh 谢谢!
    yuikns
    yuikns
    Apr 4, 2019
    5
    http://cpp.sh/27p4r

    test 是标记开头。

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