| C Tutorial | Comments | |||
|
Introduction to C language Integer types Char constants Int constants Type combination and promotion Int overflow Floating point types Comments Variables Assignment operator Truncation Int vs float arithmatic Mathematical operators Unary Increment Operators Pre and Post Variations C Programming Cleverness and Ego Issues Relational Operators Logical Operators Bitwise Operators Other Assignment Operators
|
Comments in C are enclosed by slash/star pairs: /* .. comments .. */ which may cross multiple lines. C++ introduced a form of comment started by two slashes and extending to the end of the line: // comment until the line end The // comment form is so handy that many C compilers now also support it, although it is not technically part of the C language.
Along with well-chosen function names, comments are an important part of well written code. Comments should not just repeat what the code says. Comments should describe what the code accomplishes which is much more interesting than a translation of what each statement does. Comments should also narrate what is tricky or non-obvious about a section of code.
|
|