C++ Programming Tutorial 3 - Comments in C++ | Sinhala







Comments in C++ Programming



Comments are used mainly to describe the code.

Comments are ignored by the compiler.



There are two types of comments:



Single line comments.

Multi-line comments.



Single line comments start with two forward slashes //

Comments are just to describe the code,they are never executed.



Multi-line comments:

This type of comments are used to comment out multiple lines.

This type is better for giving a detail description of how the code functions.

Multi line comments start with /* and end with */

In between the content is added.



Multi line comments span multiple lines.

You can even nest comments one type of comment inside another .

Adding comments in the code makes no difference to

The results of the code is as the comments have no influence on the code.



Adding comments is a good practice as it facilitates a clear understanding of the code for you and others as well.



Example:

/* Hello user this

Is an example of multi line commenting*/



Download the PDF @ https://goo.gl/NieqYW

All Codes Can be downloaded @ https://goo.gl/WBiiKI

Download The Dev-C++ IDE @ https://sourceforge.net/projects/orwelldevcpp/

Comments

Popular posts from this blog

Dark Sensitive Circuit With C828 Transistor In Sinhala