Home > Article > Backend Development > There are several annotation methods in C language
C language has two comment methods, one is a block comment starting with /* and ending with */; the other is a single-line comment starting with // and ending with a newline character. The specific usage is as follows: [const double pi = 3.1415926536; // pi is a constant].
When writing C language source code, you should use more comments to help understand the code.
(Recommended learning: C Language Tutorial)
There are two comment methods in C language:
One It is a block comment that starts with /* and ends with */;
The other is a single-line comment that starts with // and ends with a newline character (line comment) .
Example:
You can use /* and */ delimiters to mark comments within one line, or to mark comments on multiple lines.
For example, in the following function prototype, the ellipsis means that the open() function has a third parameter, which is optional.
The comment explains the usage of this optional parameter:
int open( const char *name, int mode, … /* int permissions */ );
You can use // to insert a whole line of comments, or write the source code in a two-column format, with the program in the left column, Note in the right column:
const double pi = 3.1415926536; // pi是—个常量
The above is the detailed content of There are several annotation methods in C language. For more information, please follow other related articles on the PHP Chinese website!