gpt4 book ai didi

c - C中双斜杠后的分号

转载 作者:行者123 更新时间:2023-12-02 05:44:20 25 4
gpt4 key购买 nike

我有一个关于C语言注释的问题。
例如当我们写

//this is the first step

这意味着发表评论。

但是当我们写
//this is the first step;

这是否也意味着发表评论?我的意思是,当我们在双斜杠后添加分号时,这是否意味着程序的注释或主要部分?

最佳答案

双斜杠注释掉了行。编译器将忽略整行(包括分号,是)。

对于多行注释,或与某些代码在同一行注释,请在此处使用/ *注释* /

Wiki在这里有一些很好的信息:http://en.wikipedia.org/wiki/C_syntax#Comments

注意(来自Wiki):

C++ style line comments start with // and extend to the end of the line. This style of comment originated in BCPL and became valid C syntax in C99; it is not available in the original K&R C nor in ANSI C:

关于c - C中双斜杠后的分号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8780682/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com