Comments //
/* */
This page was translated by a robot.
In the C and C++ languages, source code can contain single-line and bracketed comments. Single-line comments begin with a double slash //, causing the compiler to ignore all characters to the end of the lineieren.
Comments in parentheses are within the character string /*and */all characters, including line breaks, that are in between are ignored by the compiler.
Details
Writing comments is important, firstly, to make the code easier to understand for a stranger who may need to understand it. Last but not least, comments are also a help for the programmer himself and a design tool. For example, important code blocks can be highlighted using visually supporting comments. In addition, modern editors often color comments in a special color, which provides additional orientation.
Basically, the one-line comments are intended for writing short comments or commenting out entire lines. The bracketed comments are there to enclose longer explanatory texts or to hide part of the code in the middle of a line.
Parenthesized comments cannot be nested. Since the compiler ignores all characters (including the character string /*), the first concluding character string */is regarded as the end of the comment.
Caution is also advised with single-line comments. If a single-line comment has a backslash at the end of the line , the end of the line is removed \by the endline escape character and the compiler also ignores the following line. The following example will therefore never produce any output:
Next Chapter: Compiler, Linker