How to annotate C language programs?

Release: 2020-04-17 13:44:34
Original
10096 people have browsed it

How to annotate C language programs?

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 */ );
Copy after login

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是—个常量
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template