Monday, September 7, 2020

Stricture of c program.

 Structure of c program:

• C program can be viewed as group of building  blocks called function.

• A c-program may contain one or more sections as shown below.

DOCUMENTATION SECTION

Link Section

Definition Section

Global Declaration Section

main() Function Section

{          Declaration part

            Executable part

}

Subprogram Section

       Function 1

       Function 2

       :     :          :    (user defined functios)

       Function 3

 1] Documentation Section:

• The documentation section consists of a set of comment lines givings the name of the program, the auther and details about the programs.

• Ex: /*purpose : program for even or odd numbers*/

2] Link section:

• The link section provides instruction to the compiler to link function from the system library.
 
• Generally it uses "#include" prepocessor directives.

• Ex:     #include<stdio.h>
             #include<conio.h>
             #include<math.h>
3] Defination section:

• The defination section defines all sysmbolic constants.

• Generally it uses "#define" reprocessor directive.

• Ex:    #define     MAX 200
4] Globale declaration section:

• The variables that are used in more than one function are called as global variable.

• Globale variables and user defined function are declared in the global declaration section.

• Ex:    int MAX   ( int A, int B);
5]  main() function section:

• Every C-progrm must contain one, and only one, function called main,where execution begins. 

• This section contains two parts, declaration and executable part.

• The declaration part declares all the variables used in executable part.
6] subprogram section :

• The subprogram section contains all the user-defined function that are called in the functon.


No comments:

Post a Comment

Object Paradigm Oriented Programming in C++ / object oriented programming / History of C++/ paradiagram in c++/C devolop, Operating System, Unix operating system, Assembly language, popular in world, Programming language.

  Object Paradigm Oriented Programming  Two programmers, Brian Kernighan and Dennis Ritchie developed a new language called C, in 1972.  C l...