Basic Structure of a C program contains following sections,
Documentation Section Link Section Definition Section Global Declaration Section main() { Declaration Section Executable part } Subprogram section Function 1 Function 2 . . function n |
The Documentation Section consists of a set of comment lines giving the name of the program and other details.
The Link Section provides instructions to the compiler to link functions from the system library.
The Definition Section defines all symbolic constants.
The Global Declaration Section: There are some variables and those variables are declared in this section that is outside of all functions.
main() function: Every C program must have one main function section. This section contains two parts, declaration and executable part.
Declaration Part declares all the variables used in the executable part.
There should be at least one statement in the executable part which contains instructions to perform certain task.
The declaration and executable part must appear between the opening and closing braces. All statements in the declaration part should end with the semicolon.
The Subprogram Section contains all the user defined functions that are called in the main function.
Example Program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /*Documentation Section: program to find the area of circle*/ #include "stdio.h" /*link section*/ #include "conio.h" /*link section*/ #define PI 3.14 /*definition section*/ float area; /*global declaration section*/ void main() { float r; /*declaration part*/ printf("Enter the radius of the circle\n"); /*executable part starts here*/ scanf("%f",&r); area=PI*r*r; printf("Area of the circle=%f",area); getch(); } |
gud…..
it is best
thank you very much 🙂
yo yo
gud
Thanks
thanx to help us
Good site. For. C learners
It is very easy to learn C programs
It is very easy to learn C programs
very is to learn,thank u so much.
Very easy to learn,Thank u so much
Tnx for help & support
Thank you.yo yo