How can I use goto function across different functions .For ex ,
main() { .... REACH: ...... } void function() { goto REACH ; }
How to implement such usage ?
You can't in Standard C++. From $6.6.4/1 of the C++ Language Standard
The goto statement unconditionally transfers control to the statement labeled by the identifier. The identifier shall be a label (6.1) located in the current function.
...or in Standard C. From $6.8.6.1/1 of the C Language Standard
The identifier in a goto statement shall name a label located somewhere in the enclosing function. A goto statement shall not jump from outside the scope of an identifier having a variably modified type to inside the scope of that identifier.
1.4m articles
1.4m replys
5 comments
57.0k users