The comment line was introduced above and needs to be
explored a little further. As stated above, a C comment line
is any thing contained between the /* and the */. You should
use comment lines to make your code easy to understand. You
will also see in the examples the use of the C++ comment line
that starts with two backslash characters //. Anything after
the // to the end of the line is considered a comment. Note
that although most C compilers support the C++ comments, your
code might not be portable to other compilers.
The following shows examples of C comments.
/* Classic C Comment line that starts at position 1 of the
line */
/* Classic C Comment line that starts at position 10 of the
line */
short x; /* Classic C Comment used with a C statement */
// C++ comment starting at position 1 and saying that this
line is a comment
// C++ comment line starting at
position 5
short x; // C++ comment used with a C statement
/* --------------------------------------------------------
** Classic C comment spanning multiple lines.
** -----------------------------------------------------*/
Although you are encouraged to use comment lines to explain
what your program is doing, you might notice that some of the
software used in the projects do not have comments. This is
done basically to make sure the code fits on the page and is
usually because it was explained previous to the example.