0% found this document useful (0 votes)
2 views4 pages

2 Programming Paradigms Structured Programming Notes

Structured programming is a methodology that enhances C programming by improving readability, reliability, and maintainability through modular design and control structures like sequence, selection, and iteration. It emerged in the 1960s and 1970s, addressing the challenges of unstructured programming. The approach promotes easy debugging and maintenance, although it may be less suitable for very large systems compared to object-oriented programming.

Uploaded by

ezhilr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

2 Programming Paradigms Structured Programming Notes

Structured programming is a methodology that enhances C programming by improving readability, reliability, and maintainability through modular design and control structures like sequence, selection, and iteration. It emerged in the 1960s and 1970s, addressing the challenges of unstructured programming. The approach promotes easy debugging and maintenance, although it may be less suitable for very large systems compared to object-oriented programming.

Uploaded by

ezhilr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Programming Paradigms: Structured Programming

Programming in C Notes
Based on Reema Thareja (3rd Edition, 2023), Deitel & Deitel (2022), and Pradip Dey
& Manas Ghosh (2018)

Introduction
A programming paradigm is a style or approach used for designing and organizing
programs. Structured programming is the most important paradigm in C
programming because it improves readability, reliability, and maintainability.

Definition of Structured Programming


Structured programming is a programming methodology that divides a program
into small, manageable modules and uses three control structures: sequence,
selection, and iteration.

History of Structured Programming


Structured programming emerged in the 1960s and 1970s. Major contributors
include Edsger W. Dijkstra, C.A.R. Hoare, and Niklaus Wirth. Dijkstra strongly
opposed the excessive use of the goto statement.

Need for Structured Programming


Unstructured programs were difficult to understand, debug, and maintain.
Structured programming introduced organized control flow and modular design.

Characteristics of Structured Programming


 Modularity
 Top-down design
 Block structure using braces {}
 Single entry and single exit
 Avoidance of goto statements

Basic Control Structures


 Sequence – statements execute one after another.
 Selection – decision making using if, if-else, and switch.
 Iteration – repetition using for, while, and do-while loops.

Sequence Example
int a = 10;
int b = 20;
int c = a + b;
printf("%d", c);

Selection Example
if (a > b)
{
printf("A is greater");
}
else
{
printf("B is greater");
}

Iteration Example
for(int i = 1; i <= 5; i++)
{
printf("%d ", i);
}

Modular Programming
Structured programming divides programs into functions. This improves code
reuse, testing, and maintenance.

Top-down Approach
A complex problem is divided into smaller modules such as input, processing, and
output modules.

Advantages of Structured Programming


 Easy debugging
 Easy testing
 Better readability
 Better maintenance
 Code reuse
 Reduced complexity
 Improved documentation

Disadvantages of Structured Programming


 Less suitable for very large software systems
 Limited data protection
 Functions may become highly dependent
 Less abstraction than object-oriented programming
Structured vs Unstructured Programming
Structured Programming Unstructured Programming

Modular design Monolithic design

Uses functions Uses goto statements

Easy debugging Difficult debugging

Easy maintenance Difficult maintenance

High readability Low readability

Example Structured C Program


#include <stdio.h>

int add(int x, int y)


{
return x + y;
}

int main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("Sum = %d", add(a,b));
return 0;
}

Best Practices
 Use meaningful variable names
 Keep functions small
 Avoid goto
 Use comments
 Indent code properly
 Minimize global variables
 Follow modular design

Examination-Oriented Short Notes


Structured programming uses sequence, selection, iteration, and functions to create
organized and maintainable programs.
Three control structures: sequence, selection, and iteration.

Top-down design divides a complex problem into smaller modules.

Advantages: easy debugging, readability, and maintainability.

Conclusion
Structured programming is the foundation of C programming. It emphasizes
modularity, top-down design, and controlled program flow, enabling the
development of reliable and maintainable software.

References
1. Reema Thareja, Programming in C, 3rd Edition, Oxford University Press, 2023.

2. H.M. Deitel & P.J. Deitel, C: How to Program, 9th Edition, Pearson, 2022.

3. Pradip Dey & Manas Ghosh, Programming in C, Oxford University Press, 2018.

You might also like