Say I got 2 C source files A.c, B.c.
A.c contains a label, that I want to just to from the module B.c.
A.c contains only 1 function:
int f() {
// some commands
aLabel:
// some more commands
return 1;
}
B.c also contains only 1 function:
extern aLabel;
int g() {
// do some stuff
goto aLabel;
}
Obviously these 2 files are linked together to a final .exe file.
How do I jump to an external label?
Thanks in advance.
goto is always local to a function, you cannot jump between functions using goto. To do non-local jumps take a look a setjmp / longjmp C functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With