Thursday, 7 November 2013

STRUCTURE OF A C PROGRAM

 Structure of a C program

/* Documentation section */
/* Link section */
/* Definition section */
/* Global declaration section */
main() { Declaration part
Executable part (statements) }
/* Sub-program section */
 The documentation section is used for displaying any information about the program like the purpose of the program, name of the author, date and time written etc, and this section should be enclosed within comment lines. The statements in the documentation section are ignored by the compiler.
 The link section consists of the inclusion of header files.
 The definition section consists of macro definitions, defining constants etc,.
 Anything declared in the global declaration section is accessible throughout the program, i.e. accessible to all the functions in the program.
 main() function is mandatory for any program and it includes two parts, the declaration part and the executable part.
 The last section, i.e. sub-program section is optional and used when we require including user
defined functions in the program

No comments:

Post a Comment