Basic Structure of C Programming

Here You will Learn about Basic Structure of C Programming

Any of the C Program is consist of  6 main Section. Below The Image, you will find a brief explanation of each of the sections.

Basic Structure of C Program

Documentation Section
This section consists of comment lines which include the name of the programmer, the author, and other details like the time and date of writing the program. The documentation section helps anyone to get an overview of the program.
Link Section
The link section consists of the header files of the functions that are used in the program. It provides instructions to the compiler to link functions from the system library.
Definition Section
All the symbolic constants are written in the definition section. Macros are known as symbolic constants.
Global Declaration Section
The global variables that can be used anywhere in the program are declared in the global declaration section. This section also declares the user-defined functions.
main() Function Section
It is necessary to have one main() function section in every C program. This section contains two parts, declaration and executable part. The declaration part declares all the variables that are used in the executable part. These two parts must be written in between the opening and closing braces. Each statement in the declaration and executable part must end with a semicolon (;). The execution of the program starts at opening braces and ends at closing braces.
Subprogram Section
The subprogram section contains all the user-defined functions that are used to perform a specific task. These user-defined functions are called in the main() function.
Example:-
//Sample program           Documentation section
#include<stdio.h>           Link Section
#include<conio.h>
void abc();             Defination section
int a =10;     Global Declaration Section
void  main(){
  int b=2;
  clrscr();                      
  printf(“b=%d\n”,b); main
  abc(); 
  getch();
}
void abc(){
printf(“This is the subprogram part and a=%d”,a);         Subprogramme
}



Comment below if you have any queries related to the above tutorial for an Basic Structure of C Programming

Post a Comment

0 Comments