Why Comments are used in C++?
Comments in C++ are used to summarize an algorithm, identify a variable’s purpose, or clarify a code segment that appears unclear. Comments are also used for:
- Comments are used for easier debugging.
- It makes a program more readable and gives an overall description of the code.
- Comments are helpful in skipping the execution of some parts of the code.
- Every time a program or code is reused after long periods of time, the comment recaps all the information of the code quickly.
C++ Comments
Comments in C++ are meant to explain the code as well as to make it more readable. When testing alternative code, it can also be used to prevent execution. The purpose of the comments is to provide information about code lines. Programmers commonly use comments to document their work.
Contact Us