Structure of c
1. Documentation section: (optional) It is used to write comments in the program which shows the name of the author or description of the program and other details.
Comments are of two types
Example:
Example:
- // HERE YOU CAN WRITE YOUR COMMENTS IN A SINGLE LINE
- // Created by buildup c language
- /* HERE YOU CAN WRITE YOUR COMMENTS IN MULTIPLE LINES*/
- /* Please subscribe our blog from mail notification- left sidebar */
2. Link section: It gives the instruction to the compiler to link the function from the system library in the program.
Example:
Example:
#include <stdio.h>
#include <conio.h>
#include <math.h>
3. Definition section: It defines all the symbolic constants.
Example:
Example:
void fun();
4. Global declaration section: It is used when more than one variable is used in a function.
Example:
5. main: Every c program have at least one main function. Your program executes from here. In which it contains two parts namely, declaration part and executable part.
Declaration part: Declares all the variables in the executable part.
Executable part: It contains statements that are to be executed by the compiler.
Example:
6. Sub-program section: User-defined functions are declared and usually defined after the main() function. It deals with all the user-defined functions that are called from the main().
Example:
Example:
int a=1;
Note that we will discuss this in detail later on in chapter (FUNCTION).
Declaration part: Declares all the variables in the executable part.
Executable part: It contains statements that are to be executed by the compiler.
Example:
main()
{ execution starts
Declaration part
Executable part
execution ends}
Example:
[User defined function[
Function 1
Function 2
.
.
.
Function n

Comments
Post a Comment