In a recent interview among other questions this was one of the question which was asked - Why we should not use GOTO statement?
I was not sure about the answer, though I said,it usually depends on the standards of the particular company. But I think there is more to it - can someone please assist me in knowing the answer.
Why we should not use GOTO statement?
- Robert Sample
- Global Moderator
- Posts: 1885
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Why we should not use GOTO statement?
In March 1968, Communications of the ACM published an article by Edsger Dijkstra titled "Go To Statement Considered Harmful". His article made the argument that the GO TO statement led to complicated logic, making programs harder to understand, as well as causing logic errors from jumping around in the code. If you Google "go to considered harmful" you can find and read the article.
These days, GO TO statements are rarely used due to the prevalence of structured programming and its reliannce on code that does not contain GO TO statements. Most languages still support them, however, so it is good to understand some of the history around GO TO statements.
These days, GO TO statements are rarely used due to the prevalence of structured programming and its reliannce on code that does not contain GO TO statements. Most languages still support them, however, so it is good to understand some of the history around GO TO statements.
Re: Why we should not use GOTO statement?
Thanks Robert. I read the article and it's too detailed. Appreciate your help.
- CharlesFKelly
- New Member
- Posts: 7
- Joined: Mon Feb 24, 2014 12:44 pm
Re: Why we should not use GOTO statement?
Can you plz explore more on GO TO statement and its importance in C language.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute