C examples for setjmp.h:longjmp
function
<setjmp.h> <csetjmp>
Long jump
void longjmp (jmp_buf env, int val);
Restores the environment to the state indicated by env, evaluating the setjmp expression that filled env as val.
Parameter | Description |
---|---|
env | jumping point to restore |
val | Value to which the setjmp expression evaluates. If this is zero, the expression evaluates as 1. |
none.
#include <stdio.h> #include <setjmp.h> int main()// w w w . ja v a 2 s . co m { jmp_buf env; int val; val=setjmp(env); printf ("val is %d\n",val); if (!val) longjmp(env, 1); return 0; }