Basic-Structure-of-C-Program .

In this session i have discussed basic structure of c program .


Basic Structure of C Program

The C program can be divide in 6 main sections .

1-Document Section

2-Link Section

3-Definition Section

4-Global Declaration Section

5-main Function Section

6-Subprogram Section


1-Document Section

This section consists of comment lines which include the name of programmer, the author and other details . Documentation section helps anyone to get an overview of the program .

2-Link Section

The link section consists of the header files . It provides instructions to the compiler to link functions from the system library.

3-Definition Section

In this section we can define the macros also known as symbolic constant .

4-Global Declaration Section

The global variables that can be used anywhere in the program are declared in global declaration section. This section also declares the user defined functions .

5-main Function Section

It is must every C program has one main function . It is the entry point for the compiler . This section contains two parts, declaration and executable part. The declaration part declares all the variables that are used in executable part. These two parts must be written in between the opening and closing braces. Each statement in the declaration and executable part must end with a semicolon (;). The execution of program starts at opening braces and ends at closing braces.

6-Subprogram Section

The subprogram section contains all the user defined functions that are used to perform a specific task. These user defined functions are called in the main() function.

Welcome to AndroidATPoint.

back image                     next image