capypad
0 day streak
cpp / beginner
Snippet

Using Code Comments

Comments are notes for developers that are completely ignored by the compiler. They are essential for documenting what the code does.

snippet.cpp
cpp
1
2
3
// Single-line comment
/* Multi-line
comment */
Breakdown
1
// Single-line comment
Uses double slashes to comment out everything until the end of the line.
2
/* Multi-line comment */
Uses forward slash and asterisk to start and end a comment block spanning multiple lines.