C++ Comments
The Comments are the explanatory statements that we can use in the C++ code. The comments are helpful in reading the source code of the program. The comments are ignored by the C++ compiler because there is no need of comments about the program compiling/execution.
Types of comments
There are two types of comments supported by C++;
- Single-line comments
- Multi-line comments.

Single-line comments
A comment can also start with //, extending to the end of the line. For example –
1 2 3 4 5 6 7 |
#include <iostream> using namespace std; main() { cout << "I love C++"; // It will print welcome to t4tutorials.com return 0; } |
Multi-line comments
C++ comments start with /* and end with */.
For example −
/* C++ comments can occupy
More than one line of comments
*/
1 2 3 4 5 6 7 8 9 10 |
#include <iostream> using namespace std; main() { cout << "I Love C++"; /* C++ comments can occupy More than one line of comments */ return 0; } |