Easy Tutorial
❮ C Exercise Example67 C Exercise Example30 ❯

C Standard Library - <setjmp.h>

Introduction

The setjmp.h header file defines the macro setjmp(), the function longjmp(), and the variable type jmp_buf, which bypasses the normal function call and return rules.

Library Variables

Below are the variables defined in the setjmp.h header file:

No. Variable & Description
1 jmp_buf <br> This is an array type used to store information for the macro setjmp() and the function longjmp().

Library Macros

The following is the only macro defined in this library:

No. Macro & Description
1 int setjmp(jmp_buf environment) <br> This macro saves the current environment in the variable environment for later use by the function longjmp(). If this macro returns directly from the macro call, it returns zero, but if it returns from a longjmp() function call, it returns a non-zero value.

Library Functions

The following is the only function defined in the setjmp.h header file:

No. Function & Description
1 void longjmp(jmp_buf environment, int value) <br> This function restores the environment saved by the most recent call to the setjmp() macro, with the jmp_buf parameter being set by the previous call to setjmp().
❮ C Exercise Example67 C Exercise Example30 ❯