// indicates the beginning of a single line comment:
Everything from // to the end of the line is ignored by the C++
compiler. Comments are intended for humans to read. Good software design
requires lots of comments for somebody else to understand what you were
thinking as you develop your program. They are also very important, more than
you will realize at first, for you yourself to remember what you were
thinking when you come back to a source program some time in the future.
// This is a single line comment. /* Old style single line comment. */ int Foo; // This is a trailing comment. int Bar; /* Old style trailing comment. */ /* This is an old style multiline comment. */ /* Disable the following code: int Foo; int Bar; */
Old style comments are deprecated, because strange things will happen
if you forget the */. (In software engineering, deprecated means
something that was formerly used is now still allowed but strongly
discouraged.)
You can carefully use an old style comment to temporarily disable a section of code.