Comment delimiters for c language are explained in detail

  • 2020-07-21 09:28:45
  • OfStack

What is the comment delimiter for c

1. The earliest C language notes were: /* */

2, later added line note: //

Where /**/ is a multi-line comment and // is a single-line comment.

It is important to note that comments in C do not appear anywhere in C code.

For example, the following comment is wrong:

[

in / *... * / t I;

]

Because the compiler replaces the comment with a space, the replaced statement is not an c statement, so an error occurs.

Knowledge points:

The C language has two annotations:

1. One-line notes:

Syntax: the content of // comments

Function: 1 line to the right of the symbol is ignored by the compiler (press enter to wrap)

Shortcut :Command + / Perform uncomment again

2. Multi-line notes:

Grammar:

[

/* The content of the comment */

]

or

[

/*
The content of the comment
*/

]

Function: Everything in the /* */ symbol is ignored by the compiler

This is the introduction of all the knowledge content, thank you for your learning.


Related articles: