C Programming

home previous next

The addition of comments inside programs is desirable. These may be added to C programs by enclosing them as follows,

	/* bla bla bla bla bla bla */

Note that the /* opens the comment field and */ closes the comment field. Comments may span multiple lines. Comments may not be nested one inside another.

	/* this is a comment. /* this comment is inside */ wrong */

In the above example, the first occurrence of */ closes the comment statement for the entire line, meaning that the text wrong is interpreted as a C statement or variable, and in this example, generates an error.

What Comments Are Used For

Basic Structure of C Programs
C programs are essentially constructed in the following manner, as a number of well defined sections.

	/* HEADER SECTION                        */
	/* Contains name, author, revision number*/

	/* INCLUDE SECTION                       */
	/* contains #include statements          */

	/* contains types and #defines           */

	/* GLOBAL VARIABLES SECTION              */
	/* any global variables declared here    */

	/* FUNCTIONS SECTION                     */
	/* user defined functions                */

	/* main() SECTION                        */

	int main() 


Adhering to a well defined structured layout will make your programs

ęCopyright B Brown. 1984-1999. All rights reserved.
home previous next