C++ TutorialLesson 6Free preview
C++ Comments
This lesson is part of C++ · All levels
Summary
This lesson explains how to add comments to C++ code to make the program easier to understand. C++ provides one-line comments with // and block comments with /*... */. Commentary is completely ignored by the compiler, so it's only useful to humans who read code.
Key points
- One line comment is written with //.
- Multi-line block comments are written with /*... */.
- The compiler ignores the comments so it does not affect the program's outcome.
- Comments are useful to explain the intent of the code and temporarily disable the code.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.