How to give Comments in C++ Language !!

Every language will provide great feature which is used in source code. We can write more readable and eye catching program structure using comments. We should use as many as comments in C++ program. “Comment is non executable Statement” in the C++.

Types of Comment in C++ Programming
  1. Single Line Comment
  2. Multiple Line Comment
Single Line Comment


  • Single Line comment starts with “//” symbol.
  • Remaining line after “//” symbol is ignored by browser.
  • End of Line is considered as End of the comment.
Multiple Line Comment in C++ Programming

int main()
/* this comment can be considered  as
multiple line comment */
cout << “Hello C++ Programming”;
  • Multi Line comment starts with “/*” symbol.
  • Multi Line comment ends with “*/” symbol.
How to use Comment more efficiently

Comment for User Documentation.
Hiding Non-usable Code.
Hiding Single Statement.
Comment used to explain particular language statement
/* Name : Main Function
 * Parameter : None
 * Return Value : Integer
 * Author: Vivek Kumar
void main()
cout << “Hello Vivek “;
  1. Comments are non Executable Statements.
  2. Comments are always neglected by compiler.
  3. Comments are replaced by white spaces during the preprocessor phase.
  4. Comments can be written anywhere and any number of times.
  5. Comments can be used for documentation.
  6. Comments can be Single Line or multiple line.

Leave a Reply