Control Structure In Data Structure | Control Structure | Control Flow | Programming Control Structures

Control Structure In Data Structure | Control Structure | Control Flow | Programming Control Structures

Control Structure In Data Structure | Control Structure | Control Flow | Programming Control Structures

Flowchart Control Overview

A control structure is a piece of programming that examines factors and picks a heading in which to go in view of given parameters. The term stream control points of interest the heading the program takes (which way program control “streams”). Consequently it is the essential basic leadership process in registering; stream control decides how a PC will react when given certain conditions and parameters. Control Structure In Data Structure



Fundamental Terminologies

Those underlying conditions and parameters are called preconditions. Preconditions are the condition of factors before entering a control structure. In view of those preconditions, the PC runs a calculation (the control structure) to figure out what to do. The outcome is known as a postcondition. Postconditions are the condition of factors after the calculation is run.

An Example

Give us a chance to break down stream control by utilizing movement stream as a model. A vehicle is landing at a convergence. In this way, the precondition is the vehicle is in movement. Assume the movement light at the crossing point is red. The control structure must decide the correct strategy to appoint to the vehicle.




Precondition: The vehicle is in movement.

Control Structure

Is the activity light green? Provided that this is true, at that point the vehicle may remain in movement.

Is the activity light red? Provided that this is true, at that point the vehicle must stop.

End of Control Structure



Postcondition: The vehicle grinds to a halt.

Subsequently, after leaving the control structure, the vehicle is halted.

In the event that THEN Statement

The IF-THEN articulation is a basic control that tests whether a condition is valid or false. The condition can incorporate a variable, or be a variable. On the off chance that the variable is a whole number 2, it will be valid, on the grounds that any number that is not zero will be valid. In the event that the condition is valid, at that point an activity happens. In the event that the condition is false, nothing is finished. To show:

On the off chance that variable is valid

At that point make this course of move.

On the off chance that the variable in reality holds an esteem steady with being valid, at that point the strategy is taken. In the event that the variable is not valid, at that point there is no strategy taken.

In the event that THEN-ELSE Statement

In the event that THEN explanations test for just a single activity. With an IF-THEN-ELSE proclamation, the control can “look both routes” in a manner of speaking, and make an auxiliary course of move. In the event that the condition is valid, at that point an activity happens. In the event that the condition is false, make a substitute move. To represent:

On the off chance that variable is valid

At that point make this course of move

ELSE call another schedule

For this situation, if the variable is valid, it makes a specific course of move and totally skirts the ELSE condition. On the off chance that the variable is false, the control structure calls a routine and totally avoids the THEN provision.

Note that you can consolidate ELSE’s with other IF’s, enabling a few tests to be made. In an IF-THEN-ELSEIF-THEN-ELSEIF-THEN-ELSEIF-THEN structure, tests will stop when a condition is valid. That is the reason you’d presumably need to put the most “likely” test to begin with, for proficiency (Remembering that ELSE’s are skipped if the main condition is valid, implying that the rest of the bits of the IF-THEN-ELSEIF… would not be handled). eg:

In the event that your PC doesn’t begin

In the event that a floppy circle is in the drive

At that point expel it and restart

ELSE IF you don’t have any OS introduced

At that point introduce an OS

ELSE call the hotline

You can have the same number of ELSE IF’s as you like.

Thanks for reading this post and don’t forget to share it and keep visits for more updates



About Ashok.cse

Hi, I'm currently studying for the Bachelor of Technology In Computer Science from Rajasthan Technical University. I am the web developer with 3+ years of experience. my range of developer services including creating the design for new apps and web platforms or building UI design for mobile, tablets or desktops. making UX designs wireframes and layouts concepts and redesigns websites are adapting to mobile and responsive design. I have worked with many clients. I am working professionally with WordPress And Adobe tools.

View all posts by Ashok.cse →

Leave a Reply

Your email address will not be published. Required fields are marked *