Prashant | Sat, 18 Jul, 2020 | 148
Comments are pieces of source code discarded from the code by the compiler. They do nothing. Their purpose is only to allow the programmer to insert notes or descriptions embedded within the source code.
C++ introduces a new comment symbol // (double slash), comments starts with a double slash symbol and terminate at the end of line.
Types of C++ comments
// This is an example to print Hello. // Author : includehelp.com. // Date : 13-02-2012.
/* This is an example to print Hello. Author : includehelp.com. Date : 13-03-2012. */
Basically we use comments in long coding, as there are thousands of lines of codes and its really hard to remember each and every line code's usage. So we do make a comment in the side, so that user can easily get for what a line is used.
That's also considered as a good practice to write code as other users can easily get your code.
So do not forget to use comments next time.