Thursday, 3 January 2013

Structure of C Program


Structure of C Program

The basic structure of C program is as follow:

Document Section
Links Section (File)
Definition Section
Global variable declaration Section
void main()
{
    Variable declaration section
    Function declaration section
    executable statements;
}
Function definition 1
---------------------
---------------------
Function definition n
where,
Document Section : It consists of set of comment lines which include name of a program, author name, creation date and other information.
Links Section (File) : It is used to link the required system libraries or header files to excute a program.
Definition Section : It is used to define or set values to variables.
Global variable declaration Section : It is used to declare global or public variable.
void main() : Used to start of actual C program. It includes two parts as declaration part and executable part.
Variable declaration section : Used to declare private variable.
Function declaration section : Used to declare functions of program from which we get required output.
Then, executable statements are placed for execution.
Function definition section : Used to define functions which are to be called from main().

No comments:

Post a Comment