Comments in C++

Program comments are illustrative proclamations that you can remember for the C++ code. These comments help anybody perusing the source code. All programming dialects take into account some type of comments.

C++ supports single-line and multi-line comments. All characters available inside any comment are ignored by C++ compiler.It can not provide output at output screen. C++ underpins single-line and multi-line comments. All characters accessible inside any comment are overlooked by C++ compiler.It can not give output at output screen.

C++ comments start with /* and end with */. For example −

/* This is a comment */
/* C++ comments can also
* span multiple lines
*/
A comments can likewise begin with //, stretching out to the stopping point. For example −
Example: -
#include <iostream>
using namespace std;

int main() {
cout << "Hello World" //print hello world return 0;
}

When the above code is compiled, it will ignore // prints Hello World and final executable will produce the following result −

Output:
Hello World

Within a /* and */ comment, // characters have no special meaning. Within a // comment, /* and */ have no special meaning. Thus, you can "nest" one kind of comment within the other kind. For example −

/* Comment out printing of Hello World:
cout << "Hello World"; // prints Hello World
*/