setjmp.h is a header defined in the C standard library to provide "non-local jumps": control flow that deviates from the usual subroutine call and return sequence. The complementary functions
longjmp provide this functionality.
A typical use of
longjmp is implementation of an exception mechanism that exploits the ability of
longjmp to reestablish program or thread state, even across multiple levels of function calls. A less common use of
setjmp is to create syntax similar to coroutines.