Languages like C++ and Java have exception-handling features built in. This is where code can happily go about its business, ignoring anything that might go wrong with the functions it is calling. But if something does go wrong, an exception can be thrown which will terminate the current flow of execution. Control resumes execution at a previously registered exception handler, which can then decide how best to recover from the problem and resume the work.
C has a primitive form of exception handling that can be used in a similar manner. The setjmp and longjmp functions are used like a super-goto:
int setjmp (jmp_buf env);
void longjmp (jmp_buf env, int value);
jmp_buf is a data structure that holds the current execution context ...