C++ Comments

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++;

  1. Single-line comments
  2. Multi-line comments.
Difference Between Single Line and Multi Line Comments in C++
Difference Between Single Line and Multi Line Comments in C++

Single-line comments

A comment can also start with //, extending to the end of the line. For example –

Multi-line comments

C++ comments start with /* and end with */.

For example −

/* C++ comments can occupy

More than one line of comments

*/

Add a Comment