The multi-line comment symbols in C language are / and /, which can comment on any line of content; nesting must be correctly matched; avoid using it in a string to prevent grammatical errors.
/*Usage in C language
In C language,/*
and */
represent a pair of multi-line comment symbols.
Grammar structure:
<code class="c">/* 这是多行注释 在C语言中,以/*开始,以*/结束 */</code>
Specific usage:
and
*/ will be ignored by the compiler and no code will be generated. This can be used to comment, explain, or temporarily disable code.
and
*/ can be nested, but they must match correctly. That is, each pair of
/* must have a corresponding
*/.
and
*/ within strings, as these symbols may also appear within string, this may result in syntax errors.
Example:
<code class="c">// 单行注释 /* * 这是一个 * 多行注释 */ int main() { /* 禁用以下代码 */ printf("Hello, world!\n"); /* 启用以下代码 */ printf("Goodbye, world!\n"); return 0; }</code>
represents a single line comment , will comment out the
printf("Hello, world!\n"); line.
and
*/ represent a multi-line comment, which will be commented out
printf("Goodbye, world!\n"); OK.
/* and
*/.
The above is the detailed content of What does /* mean in C language?. For more information, please follow other related articles on the PHP Chinese website!