Skip to content
Related Articles

Related Articles

Difference between structured and unstructured programming
  • Last Updated : 01 Mar, 2021

Structured Programming

  • Structured Programming is a type of programming that generally converts large or complex programs into more manageable and small code of pieces.
  • These small codes of pieces are usually known as functions or modules or sub-programs of large complex programs.
  • It is known as modular programming and minimizes the chances of function affecting another.

Below is the program to illustrate the structured programming:

C




// C program to demonstrate the
// structured programming
#include <stdio.h>
  
// Function for addition
int sum(int a, int b)
{
    return a + b;
}
  
// Function for Subtraction
int sub(int a, int b)
{
    return a - b;
}
  
// Driver Code
int main()
{
    // Variable initialisation
    int a = 10, b = 5;
  
    int add, minus;
  
    // Function Call
    add = sum(a, b);
    minus = sub(a, b);
  
    printf("Addition = %d\n", add);
    printf("Subtraction = %d\n", minus);
    return 0;
}
Output:
Addition = 15
Subtraction = 5

Unstructured Programming: 

  • Unstructured Programming is a type of programming that generally executes in sequential order i.e., these programs just not jumped from any line of code and each line gets executed sequentially.
  • It is also known as non-structured programming that is capable of creating turning-complete algorithms.

Below is the program to illustrate the unstructured programming:



C




// C program to demonstrate the
// unstructured programming
  
#include <stdio.h>
  
// Driver Code
int main()
{
    // Variable initialisation
    int a = 10, b = 5;
    int add, minus;
  
    // Operations performed
    add = a + b;
    minus = a - b;
  
    printf("Addition = %d\n", add);
    printf("Subtraction = %d\n", minus);
    return 0;
}
Output:
Addition = 15
Subtraction = 5

Tabular difference between structured vs unstructured programming:  

Structured Programming

Unstructured Programming

It is basically a subset of procedural programs.  It is basically a procedural program. 
In this, programmers are allowed to code a program simply by dividing the program into modules or smaller units.In this, programmers are not allowed code divide programs into small units. Instead, the program should be written as a single continuous block without any breakage.
It is more user-friendly and easy to understand as compared to unstructured programming.It is less user-friendly and little hard to understand as compared to structured programming.
It is easier to learn and follow.It is difficult to learn and follow
Its advantages include reduce complexity, facilitate debugging, increase programmer productivity programs, etc.Its advantages include its speed. 
Such programs can be used for small and medium-scale projects and also for complex projects. Such programs cannot be used for medium and complex projects. Instead, they can be used for small and easier projects. 
These programs do not allow code duplication.These programs allow code duplication.  
Structured programs use a greater number of data types as compared to unstructured programs.Unstructured programs use a limited number of data types as compared to structured programs.  
It does not use GOTO to control the flow of execution. Instead, it uses loops.  It uses GOTO to control the flow of execution.
It produces readable code.It hardly produces readable code.
It does not provide full freedom to programmers to program as they want.  It provides full freedom to programmers to program as they want.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :