Best Structure of "C" Program in c language
Structure of "C" Program
Document Section |
Link Section |
Definition Section |
Global Declaration Section |
Main() Section |
{
|
Sub Program Section
Function 1() --
|
(1) Documentation Section :-
* The documentation section consist of a set of comment lines in the c program, comments, are the user defined message that are not compiled by compiler.
* The example of comments the name of program , date, etc. * There are type types of comments are available in c language.
Single line comment :-
* We can specify a single line comment by using //symbol.Ex :- //This is single line comment
Multi line comment :-
* We can specify a multi line comment by using /*.......*/.Ex :- /* This is multi line commnet
Developer Bhautik Jivani
Date :- 03-Jul-2018 */
(2) Link Section :-
* This section provides the instructions to the compiler to link function from the system library.
* This section includes the header files are stored in the c library. These header files contains the different library functions of c language.
* The header files must be included in the c program.
Ex :- #include<stdio.h> (Standard Input Output)
#include<conio.h> (Console Input Output)
(3) Definition Section :-
* This section contains all the symbolic constants. Constants means the fixed value for defining a contsant value. We can use # Define Statement.
e.g. :- #define PI 3.14
* Here variable PI has fixed value that is 3.14. That does not change during the execution of the program.
(4) Global Declaration Section :-
* There are some user defined functions and variables are define globally that is in more than one function.
* Such variables are known as global variables and they are declaredin the global declaration section.
(5) Main() Section :-
* The c language must have one main function.
* The main function is a special function used by c language to tell the computer where the program starts.
* This section contains two parts:
Declaration Part :-
* It declares the variables that can be used in the executable part.Executable Part :-
* It executes the statements. There is at least one executable statement. That main function starts with { & ends with }.(6) Sub program/Function :-
* This section contains all the user defined functions. That are called in the main function.//This is first e.g. to print Bhautik
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("Bhautik");
getch();
}
Post a Comment