Imperative Programming is used by the most professional programmers in their day-to-day jobs or business.

The Imperative Programming is also called as Procedural Programming language which includes the programming languages like C, C++, Java, COBOL, etc.

In Imperative Programming, we can tell the computer what exactly he has to do. For example “Computer, add x & y,” or “Computer, present a dialog box onto the screen.”

An imperative Programming language uses a sequence of statements to make us understand how to reach to a certain goal and these statements are said to change the state of the program as each statement is executed in turn.

For example C is an Imperative Programming language in which a program can be created to add a sequence of numbers:

int total = 0;

int num1 = 5;

int num2 = 10;

int num3 = 15;

total = num1 + num2 + num3;

Here each statement changes the state of program from assigning values to each variable(identifier) to the final addition of these values. By using this sequence of five statements the program is explicitly told how to add the numbers 5, 10 and 15 together.

Thus, Imperative Programming involves writing a program as a sequence of instructions or statements that can actively modify memory (variables, arrays).

Imperative Programming focuses in the sense that you express the logic of a program based on how the computer is going to execute it.

Since Imperative Programming is a list of steps that has to be executed, there should be some way of keeping track of everything computed to that point.

Where obviously the variables come  in. They are changing the “state” of where the program is at which state then can control where the program should go to next state which continues to modify the state.

This sequence of  changing the state is often called as a side effect. The reason  is because it has the extreme potential to modify the state i.e. changing the flow of the program.

 

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

©2023 MYBSCIT.com. An initiative by some failures to make student scholars.

or

Log in with your credentials

Forgot your details?