C++ - Comments
Overview
Estimated time: 10–15 minutes
Add explanations to code with single-line (//) and multi-line (/* */) comments.
Learning Objectives
- Use // and /* */ for comments.
- Comment intent, not obvious facts.
Prerequisites
Examples
// Single-line comment
/* Multi-line
comment */
Common Pitfalls
- Nesting /* */ comments is not allowed.
Checks for Understanding
- Which comment style supports spanning multiple lines?
Show answers
- /* ... */