Comments are the simple text written by the coder to make understanding clear for the people who read it later or for self-understanding at a later stage. Comments are a very essential part of coding and are considered as one of the good practices while coding.
All programming language allows some form of commenting. CPP supports both single and multiple line commenting, all text inside these comments are completely ignored by the compiler.
For Single Line Comment use two slashes ( // )
//This is a single line comment
Single line comment ends at end of that line I.e. until Enter is pressed to commence a new line.
For multiple lines commenting use slash with the asterisk ( /*......*/ )
/* This is a
multiple
line
comment */
Multiple line comments start and end at slash with the asterisk, using this you can comment various lines of your code at an instant
Benefits of Proper Commenting:
- It makes your Code more readable.
- It adds meaning to your code for others.
- It helps in even debugging your code.