Comments

C++ has two types of comments: block comments and end-of-line comments. Block comments start with a two-character symbol '/*' and end with a two-character symbol '*/'; end-of-line comments start with a two-character symbol '//' and end at—yes, you've guessed it—the end of line; that is, at a next newline character in the source file. The two-character symbols are quite common in C++. Most of them are inherited from C. Using the two-character symbols for operators and in other contexts instead of additional keywords was one of the ways the designers of C managed to design the language with only 30 keywords (and persuaded everyone that C was indeed a very small language).

The characters of two-character symbols (all two-character symbols ...

Get Core C++ A Software Engineering Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.