When writing C language source code, you should use more comments to help understand the code. There are two comment methods in C language:
One is a block comment starting with /* and ending with */;
The other is starting with // , a single-line comment ending with a newline character (line comment).
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 and the comments in the right column:
const double pi = 3.1415926536; // pi是—个常量
Recommended: "c Language Tutorial"
The above is the detailed content of How to annotate C language programs?. For more information, please follow other related articles on the PHP Chinese website!