Comments are a way of inserting remarks and reminders into code without affecting its behavior. Since comments are only read by other humans, you can put anything you wish to in a comment, but it is better to be informative than humorous.
The compiler ignores comments, treating them as though they were whitespace (blank characters, such as spaces, tabs, or carriage returns), and they are consequently ignored. During compilation, comments are simply stripped out of the code, so programs can contain any number of comments without losing speed.
Because a comment is treated as whitespace, it can be placed anywhere whitespace is valid, even in the middle of a statement. (Such a practice can make your code difficult to read, however.)
Any text sandwiched between
*/ in C code is a
comment. Here is an example of a C comment:
/* ...... comment ......*/
Comments do not necessarily terminate at the end of a line, only with
*/. If you forget to close a comment with the
*/, the compiler will display an
comment error when you try to compile your code.