Comments in C++


 

Comments:

Comments are used for better understanding of the program statements. The comment entries start with a // symbol and terminate at the end of the line.Comments can be add to a c++ nbprogram to improve its readability lines return after (//) is ignore by the compiler . In c++ there are two types of comments.

1.) Single Line comments

2.) Multiple line comments

1.) Single Line comments :This type of comments are used for single line.e.g

// this program display the message ‘welcome to WHO’

( // ) Symbol  is used for single line

2.) Multiple line comments: This type of comments are used for Multiple lines.e.g

/*  hello.cpp (program name)

this program display the message ‘welcome to WHO’   */

For multiple lines comments we used this Symbol (/*) starting of the line (*/) symbol is used for end of the lines

Anything  return between these signs is ignore by the compiler.Note that comments cannot be nested.

Comments are closed.