November 2002
Beginner
432 pages
11h 44m
English
A C comment is the same as a Visual Basic remark. Comments document the code. A comment begins with /* and ends with a closing */, even if the comment spans several lines of code. C comments can go anywhere in a program, including the end of a line.
What does the following C statement do?
return ((si < s2) ? si : s2));
How could anyone expect to know what that statement does? Even an advanced C programmer will have to analyze the statement for a while to understand it. A simple comment makes everything much easier, as the following statement shows:
return ((s1 < s2) ? s1 : s2); /* Finds the smaller of 2 values */
From the comment, you know that the statement locates the smaller of the two values stored in s1 and s2 (s1 and s2