What is Structure in C program
Structure of the C program
Q) Draw the structure of the C program. Also, give one example.
Q) Write and explain the structure of a C program.
Almost all programs are written using the following general structure.
This section consists of a set of comment lines that describe the name of the program, its purpose and other information.
This is my first C program
- Link section:
This section contains the instruction for linking the library function with the program. It general contents #include preprocessor directives.
E.g. # include <studio.h>
- Definition section:
This section is used to define the symbolic constants used in the program. It generally contains #define preprocessor directive.
#define PI 3.14
- Global Declaration Section:
This section is used for global variable declaration and function declaration used in the program.
int maximum (int, int);
- main() function section:
Every program must contain the function called the main()function. The execution of a program is started from the main() function.
- Sub-program section:
This section is used to define the user-defined function.
/*Document section (program for addition)*/
# include <stdio.h> /* Link section */
void main() /*main() function*/
int a=10, b=5, c;
c = a + b ;
printf(“addition is =%d”, c);