#include <stdio.h> |
#include <setjmp.h> |
#include <stdlib.h> |
void subroutine( jmp_buf ); |
int main( void ) |
{ |
int value; |
jmp_buf jumper; |
value = setjmp (jumper); |
if (value != 0) |
{ |
printf ( "Longjmp with value %d\n" , value); |
exit (value); |
} |
printf ( "About to call subroutine ... \n" ); |
subroutine(jumper); |
return 0; |
} |
void subroutine( jmp_buf jumper) |
{ |
longjmp (jumper,1); |
} |