- By using comments we increase readability of program.
- Readers can understand more quickly the logic of program and working of program on every line.
- C++ comments are one of the important feathers of C++ programming. They are very useful to explain not only working of program but every point of every line of program. Suppose if you are coding or typing a lengthy C++ program and you are using comment in this program during coding due to some reason you need to close your program and you save your incomplete program after some days when you find time to continue your work at first look when you look your code and also on comments line by line things are re call very quickly in your mind about your program. In this way you can start your coding again confidently.
- Comments help you to understand and remember the every line of your program.
- On the other hand if you not use comments in your lengthy program and you have to start your code or program from line number 1500 to start your code you will re call your code and it is possible you may be confuse at the certain line of code that you have code yourself. Avoid from this confusing situation comments should always use in lengthy programs.
- Let have a look to this page to learn the concept about comments.
Latest Simple C++ Programs
Writting comments in C++ Programming
Comments in C++
"Comments are usually consisting of words in C++ program which are the non-executable parts of program and compiler does not translate comments".
Types of comments
1) Single line comments 2) Multiple line comments
Single line comments:
It starts with two back slashes // and followed by your description line or word
For example: //this is a C++ program
Multiple line comments:
Multiple line comments are used when we want to write comments in multiple lines.
It starts with a slash followed by asterisk /* and ends with asterisk and slash */
/*C++ is an high level language and
I like it*/
Question is that why we use comments?