answersLogoWhite

0


Best Answer

goto is a statement, not a programming style.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why goto is not a good structured programming style?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What Example of structured programming?

C is a structured programming language. PHP, COBOL is also a structured programming language. These languages follow a top down approach.


Need of structured programming?

That basically refers to a programming language that has support for conditional statements (if), code repetition (while, for, ...), and subroutine or function calls. Most modern language have that. The term is also sometimes used for languages that do NOT work with OOP. Actually OOP includes the structured programming concepts mentioned above, but it includes a few other things, too.


Structured programming concepts in c?

Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could lead to "spaghetti code" which is both difficult to follow and to maintain.


What is the Limitations of structured program?

Statement goto is not allowed.


Is there any other keyword like goto in c plus plus?

The goto statement is a control flow statement that causes the CPU to jump to another spot in the code. This spot is identified through use of a statement label. The following is an example of a goto statement and statement label:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include <iostream> #include <cmath> int main() { using namespace std; tryAgain: // this is a statement label cout << "Enter a non-negative number"; double dX; cin >> dX; if (dX < 0.0) goto tryAgain; // this is the goto statement cout << "The sqrt of " << dX << " is " << sqrt(dX) << endl; }

Related questions

What Example of structured programming?

C is a structured programming language. PHP, COBOL is also a structured programming language. These languages follow a top down approach.


Need of structured programming?

That basically refers to a programming language that has support for conditional statements (if), code repetition (while, for, ...), and subroutine or function calls. Most modern language have that. The term is also sometimes used for languages that do NOT work with OOP. Actually OOP includes the structured programming concepts mentioned above, but it includes a few other things, too.


Structured programming concepts in c?

Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could lead to "spaghetti code" which is both difficult to follow and to maintain.


What is the Limitations of structured program?

Statement goto is not allowed.


Is there any other keyword like goto in c plus plus?

The goto statement is a control flow statement that causes the CPU to jump to another spot in the code. This spot is identified through use of a statement label. The following is an example of a goto statement and statement label:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include <iostream> #include <cmath> int main() { using namespace std; tryAgain: // this is a statement label cout << "Enter a non-negative number"; double dX; cin >> dX; if (dX < 0.0) goto tryAgain; // this is the goto statement cout << "The sqrt of " << dX << " is " << sqrt(dX) << endl; }


Why does spaghetti code have a shorter shelf life than structured code?

We can say it as an un-structured and non maintainable source code. It is unpredictable and no proper programming style will be available. For example it uses many Goto statements rather than structured style. It has complex and tangled control structure. Structures in programming: The three basic structures are: Sequence It can be used to perform action or task in the program 2. selection It is a decision structure 3.Loop It is used in repeating actions Loop: Here we can continue to repeat a certain actions based on a condition. In this it asks you a Boolean condition if it fails then some actions will be performed else it will out of the loop and continue with the other actions.


Characteristics of structured programming languages?

That basically means that structures such as "for", "while", "if", are used, as well as subroutines - as opposed to lots of "goto" statements that jump around all over the place... and make the code hard to read.


Why goto statements are not available in java?

Using "goto", even in languages where it is available, is generally considered bad programming practice.


What is the difference between structure oriented and object oriented programming language?

the main difference is that structured programming deals with the flow of execution, and not, primarily, with the data. The mathematical basis for structured programming has to do with the elimination of arbitrary jumps (GOTOs) in favor of code blocks and functions. In particular, "information hiding" as it relates to data isn't fully developed in structured programming; structured programming has to do with the organization of the code, rather than the data, and pure structured programming passes data around in the form of function arguments (conceptually, "on the stack"). In contrast, object oriented programming primarily deals with data issues. The object/class paradigm promotes clean, flexible organization of data in the same way that structured programming promotes clean, flexible organization of code. In a pure object oriented approach, the flow of program execution is treated as bits of behavior associated with the packets of data that are "objects".


What programming statement did Edsger Dijkstra want to eliminate?

He considered the "goto" statement to be harmful.


Advantages of Jackson structured programming?

The main reason modular (or structured) programming is important is that it avoids the increased possibility of data corruption. Of course modular elements still have that risk but that is usually down to the user (passing by Ref instead of by Val etc.). However by using non-modular programming you can easily corrupt data without even knowing it.Non-Modular code is normally referred to as spaghetti code. Spaghetti code is typically code that uses lots of "GOTO" which although supported by VB should be avoided.One bad point of GOTO statements other than the fact they jump around unpredictably is their reliance on line numbers. If u add a line in the wrong place it can literally destroy your code.This is because the GOTO command is basically a one way link so somewhere else in the code. At the end of that code will be a GOTO to get back, this is considered very messy as it leaves a virtual "trail" that can not only make it hard for other programmers to understand but also jeopardise the reliability of data via unknown lines of code changing/interacting with the stored data.It also means the programmer needs to make sure the GOTO's are in the right place which adds a greater chance of user related mistakes."Structured Programming" is a idea that Modularity is closely associated with. It is the idea that structuring the program makes it easier for us to understand and therefore easier for teams of developers to work simultaneously on the same program. One advantage of structured programming is reduced complexity. Modularity allows the programmer to tackle problems in a logical fashion. Also, using logical structures ensures that the flow is clear. It is also a time saver, without modularity, code that is used multiple times needs to be written every time it is used whereas all you have to do is call a function with that code in to get the same result in a structured program.


Is a function call a form of branching in C plus plus?

No. A branch is akin to a goto statement in procedural programming. The code branches off to a new code segment, never to return. A function call is akin to a subroutine in structured programming. When the subroutine is finished, control is returned to the instruction immediately following the function call, just as if the function's code were inline expanded at the call site.