Page 1 of 1

Why we should not use GOTO statement?

Posted: Fri Nov 01, 2013 6:26 pm
by Makrand
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.

Re: Why we should not use GOTO statement?

Posted: Fri Nov 01, 2013 7:19 pm
by Robert Sample
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.

Re: Why we should not use GOTO statement?

Posted: Mon Dec 02, 2013 2:58 pm
by Makrand
Thanks Robert. I read the article and it's too detailed. Appreciate your help.

Re: Why we should not use GOTO statement?

Posted: Wed Feb 26, 2014 10:54 am
by CharlesFKelly
Can you plz explore more on GO TO statement and its importance in C language.