Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

The GNU C Programming Tutorial - Comments

Node:Comments, Next:, Previous:A word about style, Up:The form of a C program



Comments


Annotating programs.

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 /* and */ 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 the characters */. If you forget to close a comment with the characters */, the compiler will display an unterminated comment error when you try to compile your code.

 
 
  Published under free license. Design by Interspire