Local Jumps Goto - Programming Tutorials

Programming Tutorials

Programming Tutorials

Ads Here

Local Jumps Goto

We can jump to any statement inside the same function using goto. To spot the end point of the jump a label (tag) is used. goto statement is not to ideal to choose in any programming language because it makes difficult to trace the flow of a program, makes the program hard to understand, and to guess the output. void any_function(void) { for( ... ) if (problem) goto error; error: solve problem } But in the example above, remember that the code could be rewritten as: void function1(void) { for( ... ) if (problem) { solve problem return; } }

No comments:

Post a Comment