structure of C programming
C programming is a structured oriented programming language.
1. documentation section:
It consists set of comments such as name of the program, author and other detail which we want to use in future.
There are two types of comments such as a "single line comments" or "multiline comments".
- Single line comments
For example: // my first program
- multiline comments
For example: /* developed by
Fy BCA student */
2. link section:
It provides instruction to the compiler to link function from the system library
3. definition section:
In this section symbolic constant postures are define, symbolic constants means value of variable cannot be changed during execution of program.
#define PI 3.14
4. Global declaration section:
Some variables are used more than one function os those variable s are declare in global declaration section.
This kind of variables scope are throughout the program.
5. main function section:
Main function is a heart of C which tell the compiler that execution of program start from here.
One and only one main function in particular program.
Main function divided into two parts
- declaration part
- execution part
● declaration part:
In this part all variables are declare which are use in the program.
● execution part:
Process, input output and decision making statement are written in this section.
process and Declaration statements must end with semicolon(;)
6. sub program section:
It contains all the user define function which are called from main function.
example structure of C
/*write a c program
to find out area of circle*/ // documentation section
#include // link section
#define PI 3.14 // definition section
float area; // global declaration section
void main() // main function section
float r; // declaration part
printf("enter value of r:"); // execution part
} //sub program section
void process(float r) // function 1
void output(float area) //function 2
printf("area is: %f",area);