+ 3
How to use âgotoâ?
Can anyone tell me how to use âgotoâ? By the way, what are the advantages and disadvantages of âgotoâ? You can take either C++ or Java for example, for I can only use these two, thank you!
1 Answer
+ 7
ex.
int i = 5;
goto test;
i = 0;
test:
i++; // i = 6
pro: quick way for jump some line of code, exit from nested loop without particular condition.
con: goto makes difficult to trace the control flow of a program, making the program hard to understand and hard to modify