3. Key characteristics of Procedural Programming

1. Functions: The fundamental building blocks of procedural programs are functions or procedures. Each function is responsible for a specific task and can take inputs, perform operations, and produce outputs.

2. Global Variables: Data in procedural programming is often organized using global variables, which can be accessed and modified by different functions within the program.

3. Emphasis on Procedure: The focus is on defining the sequence of steps required to solve a problem. The flow of control is determined by function calls and the order of execution.

4. Limited Reusability: While functions can be reused, procedural programs may lack the level of reusability and modularity seen in other paradigms like object-oriented programming.

5. Code Reusability: Functions can be reused across different parts of the program, enhancing code modularity and reducing redundancy.

6. Simplicity: Procedural programming is often simpler to learn and understand, making it suitable for smaller projects and straightforward tasks.

Advantages of Procedural Programming

1. Simplicity: Procedural programming is relatively straightforward to learn and implement, making it suitable for beginners and smaller projects.

2. Efficiency: The linear flow of control and direct manipulation of data in memory can lead to efficient code execution.

3. Clear Structure: Programs are organized as a sequence of functions, resulting in clear and modular code.

4. Resource Efficiency: Procedural programming can use fewer system resources compared to more complex paradigms, making it suitable for resource-constrained environments.

5. Well-Suited for Simple Tasks: It’s ideal for tasks that involve straightforward sequences of steps and do not require complex data manipulation or interactions.

Disadvantages of Procedural Programming

1. Limited Reusability: Functions are reusable, but the lack of inherent modularity in the paradigm may limit code reusability as programs become larger.

2. Code Maintainability: As programs grow, maintaining and extending code can become challenging due to the lack of clear encapsulation of data and behavior.

3. Complexity Handling: Procedural programming might struggle to handle complexity and interactions between different parts of a program.

Global State: The use of global variables can lead to unintended side effects and errors if not managed carefully.