函数名: setjmp
功 能: 非局部转移
用 法: #include <setjmp.h>
int setjmp(jmp_buf env);
程序例:
#include <stdio.h>
#include <process.h>
#include <setjmp.h>
void subroutine(void);
jmp_buf jumper;
int main(void)
{
int value;
value = setjmp(jumper);
if (value != 0)
{
printf("Longjmp with value %d\n", value);
exit(value);
}
printf("About to call subroutine ... \n");
subroutine();
return 0;
}
void subroutine(void)
{
longjmp(jumper,1);
}