03 – C++ : Comments

0
56

Cplusplus Comments

We can say that program comments are important when you are writing a C++ code for your program because it serves as explanatory statements or let’s just say it’s a note to yourself that you put in the sourcecode ( best done before you actually write the codes ). These comments also help anyone reading the sourcecode and make them understand what you’re trying to do.

 

You can write as many characters as you like because C++ supports single line and multi-line comments. And don’t worry because all comments are ignored by the complier.

 

/* is used when you start to write C++ comments and it ended up with */.

Example:

 

You can also start with //, enhancing to the end of the line.

Example:

 

In the example above,  it will ignore the // Display Howdy World….  and execute the codes that you put. This will be the result.

 

Inside the /* and  */ the code have no value at all. See example below.

 

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here