Comment Statements in C++

Unlike C, C++ supports two types of comments. C programmers are familiar with the /*..*/ style of commenting. Anything lying within the /*..*/ pair is ignored by the compiler. C plus plus (C++) additionally supports the // notation of commenting.

Here, everything following // till the end of line is treated as comment.
Usually /*..*/ style is used for commenting out of a block code, whereas, // is used for single-line comments.

Example of single-line comment:

// This is a single line comment

Example of multiple-line comment:

/*This is 
a multiple line comment*/

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *