C program can be viewed a s group of building blocks called functions. A function is a subroutine that may include one or more statement designed to perform a specific task. A C program may contain one or more section as shown below:
Documentation Section:
This section contains set of comments lines consist of details like program name, author name and purpose or functionality of the program.
Link Section:
This section consist of instructions to be given to the compiler to link functions from the system library. For example if you want to use some mathematical function then you have to define link for math.h file in link section. For Example
# include
# include
Definition Section:
This section defines all the symbolic constants. For example PI=3.14. By defining symbolic constant one can use these symbolic constant instead of constant value.
# define PI 3.14
# define Temp 35
Global Declaration Section:
This section contains the declaration of variables which are used by more then more then one function of the program.
Main Function Section:
A main () function is a heart of any ‘C’ language program. Any C program is made up of 1 or more then 1 function. If there is only 1 function in the program then it must be the main program. An execution of any C program starts with main () function.
Subprogram Or Sub Function Section:
They are the code section which are define outside the boundary of main function. This function can be called from any point or anywhere from the program. Generally they are define to solve some frequent tasks.
0 comments:
Post a Comment