Structured Programming

Back - C Language Notes By Vivek Sir email: vivekdubey22@gmail.com (w) 9826424484

·       Structured programming is a logical programming method that is considered an originator to object-oriented programming (OOP).

·       In structured programming design, programs are broken the problem into smaller modules called functions or procedures each of which handles a particular task with its own data and logic.

·       Information can be passed from one function to another function through parameters.

·       A function can have local data that cannot be accessed outside the function’s scope.

·       The result of this process is that all the other different functions are combined in main function.

·       Many of the high level languages (likes: C, Pascal) are supported structure programming.

·       Structure of C Programming Language:

Documentation Section

Documentation section - Consists of comments lines which include the name of programmers, time and date. This section helps to give you an overview of the program.

Link Section

Link section - Consists of header files and also provide a instruction to compiler to link functions from the system library.

Definition Section

Definition section - Contains all the symbolic constants (Marcos).

Global Declaration Section

Global Declaration section - Those variables which can be used anywhere in the program.

void main()

main() function section - This section contains 2 parts, declaration and executable part.

 

{

Declaration Section

Executable part

}

Subprogram section

Subprogram section - contains all the user functions, which are used to perform a specific task.

Function 1

Function 2


 

The structured program mainly consists of three types of elements:

o   Sequence Statements

o   Selection Statements/Branching Statement

o   Iteration Statements/Looping Statement

Advantages of Structured Programming Approach:

1.   Easier to read and understand

2.   User Friendly

3.   Easier to Maintain

4.   Mainly problem based instead of being machine based

5.   Development is easier as it requires less effort and time

6.   Easier to Debug

7.   Machine-Independent, mostly.

 

Disadvantages of Structured Programming Approach:

1.   Since it is Machine-Independent, so it takes time to convert into machine code and require complier.

2.   The program depends upon changeable factors like data-types. Therefore it needs to be updated with the need on change data-types.

3.   Usually the development in this approach takes longer time as it is language-dependent..

 

Back - C Language Notes By Vivek Sir email: vivekdubey22@gmail.com (w) 9826424484