Home > SparkCharts > Cs > C++ > Comments

C++


 
 

Comments

In C++, comments are either single lines or blocks. Denote single line comments with the // operator. Denote a comment block by enclosing the block with /* and */.

Single line comment example:

if (x == 0) { // Single Line Comment
}

Comment block example:

if (x == 0) {
/* This is a multiline
   comment using the comment block style.
   */
}

Either style of comment can start on a line containing code as long as the comment is after the code.