C11. C Comments

Our program still lacks something important: documentation. Every pro­gram should contain identifying information: the program name, the date written, the author, the purpose of the program, and so forth. In C, this information is placed in comments. The symbol /* marks the beginning of a comment and the symbol */ marks the end:
/* This is a comment */
Comments may appear almost anywhere in a program, either on separate lines or on the same lines as other program text. Here's what our programme might look like with comments added at the beginning:
Comments may extend over more than one line; once it has seen the /* sym­bol, the compiler reads (and ignores) whatever follows until it encounters the */ symbol. If we like, we can combine a series of short comments into one long com­ment:
provides a second kind of comment, which begins with // (two adjacent slashes):
// This is a comment
This style of comment ends automatically at the end of a line. To create a comment that's more than one line long, we can either use the older comment style (/* ... */) or else put / /at the beginning of each comment line:
The newer comment style has a couple of important advantages. First, because a comment automatically ends at the end of a line, there's no chance that an exterminated comment will accidentally consume part of a program. Second, multiline comments stand out better, thanks to the // that's required at the beginning of each line.

No comments: