SoFunction
Updated on 2025-04-06

Detailed explanation of the annotation delimiter of C language

What is the annotation delimiter for C language?

1. The earliest C language annotations are: /* */

2. Later added line comments: //

where /**/ is a multi-line comment, // is a single-line comment.

It should be noted that comments in C language cannot appear anywhere in C language code.

For example, the following comment is wrong:

in/*…*/t I;

Because the compiler will replace the comment with spaces, and the replaced statement is not a c statement, an error will occur.

Supplementary knowledge points:

There are two comments in C language:

1. Single line comments:

Syntax://comment content

Function://The line content on the right side of the symbol is ignored by the compiler (press Enter to be considered a line break)

Shortcut key: Command + /     Execute uncomment again

2. Multi-line comments:

grammar:

/* Comments */

or

/*
Comments
*/

Function:/* */ All contents in the symbol are ignored by the compiler

The above are all the knowledge points introduced this time, thank you for your study.