C++ Comments

By Prof. Fazal Rehman Shamil

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

*/

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.