2. LINK SECTION –
The link section provides specific instructions to the compiler to link functions from the systems library. The link section contains header files and also function prototype of standard library functions.
stdio i.e. Standard Input-Output Header file which we use in C programs. stdio.h is a header file that the preprocessor processes before the C source code passes through compiler.
For including header files such as stdio.h in this case, we use #include i.e. a preprocessor directive.
3. DEFINITION SECTION –
To define all the symbolic constants, we use Definition Section. The commonly used preprocessor directives are #include and #define.
To include header files in the linking section, we use #include. On the other side, #define is a preprocessor directive that we use to define symbolic constants and macros.
#define PI 3.14
4. GLOBAL DECLARATION SECTION –
There are some variables in the program that we use in more than one function. Such variables are Global variables and we declare these in the Global declaration section i.e. outside of all the functions.
The section is also used to declare all the user-defined functions i.e. the functions defined by user’s choice.
Here, a is a variable of integer data type which is declared globally and can be used in many functions.
int add(int a,int b);
Here, add is a user-defined function with two integer type parameters that are a and b with return data type int.
5. main( ) FUNCTION SECTION –
If a C program contains only one function then it must be main( ). Execution of every C program starts with main( ). The section consists of two parts that are DECLARATION PART and EXECUTABLE PART.
Declaration Part :
The declaration Part asserts all the variables used in the executable part. The declaration of Local variables is done in this part. The scope of local variables is limited to that function only.
Executable Part :
All the declared variables are used in the executable part. There is at least one statement in the executable part. The execution of Statements in main( ) happens one by one.
All statements in the declaration and executable part end with a semicolon. The program execution begins from the opening brace and ends at the closing brace. The closing brace of main( ) section is the Logical end of a program.
6. SUB-PROGRAM SECTION –
The sub-program section contains all the user-defined functions that are called in the main( ). User-defined functions also have local variables and C statements. User-defined functions can be defined or placed before or after main( ). They can be placed or appeared in any order.
Thus, It was all about the General form of C program.. For information regarding History or Introduction of C Language, Click on..