##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# setjmp

From cppreference.com
< c‎ | program

Defined in header `<setjmp.h>` |  |
#define setjmp(env) /* implementation-defined */ |  |

Saves the current execution context into a variable `env` of type jmp_buf. This variable can later be used to restore the current execution context by longjmp function. That is, when a call to longjmp function is made, the execution continues at the particular call site that constructed the jmp_buf variable passed to longjmp. In that case setjmp returns the value passed to longjmp.

### [edit] Parameters

env | - | variable to save the execution state of the program to.

### [edit] Return value

​0​ if the macro was called by the original code and the execution context was saved to `env`.

Non-zero value if a non-local jump was just performed. The return value in the same as passed to longjmp.

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

longjmp | jumps to specified location (function) [edit]
C++ documentation for setjmp

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/program/setjmp&oldid=66396"
Category:

- Todo no example