Chinaunix首页 | 论坛 | 博客
  • 博客访问: 815666
  • 博文数量: 321
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 936
  • 用 户 组: 普通用户
  • 注册时间: 2013-02-23 11:25
文章分类

全部博文(321)

文章存档

2017年(1)

2016年(10)

2015年(61)

2014年(187)

2013年(62)

分类: C/C++

2014-06-24 16:23:45

原文地址:C语言实例67:跳转函数 作者:hnrainll

#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>

jmp_buf ebuf;
void fun(void);

int main(int argc, char *argv[])
{
    int i;
    printf("1 ");
    i = setjmp(ebuf);
    if(i == 0)
    {
        fun();
        printf("This will not be printed.");
    }
    printf("%d \n", i);

    system("pause");
    return 0;
}

void fun(void)
{
    printf("3 ");
    longjmp(ebuf, 5);
}


阅读(523) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~