Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : setjmp

intsetjmp(jmp_buf env) ;

Return Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of setjmp function .

1st Parameter Type : jmp_buf

A data type used by the `setjmp` and `longjmp` functions to store information about the program’s environment, including the stack, register states, and instruction pointer, allowing for non-local jumps in program execution.

1st Parameter

A buffer of type `jmp_buf` used to store the program’s environment at the point of the call for later restoration by `longjmp`.

Read more about parameters of setjmp in parameters section
The setjmpfunction in C language Saves the calling environment for longjmp.
The setjmp function saves the current execution context into the jmp_buf argument. It's used in conjunction with longjmp to implement non-local jumps. When setjmp is initially called, it returns 0. If longjmp is later called with this jmp_buf, execution returns to the point of the setjmp call, and setjmp returns the value passed to longjmp.
The setjmpfunction takes 1 parameter:
  • jmp_buf `env`: A buffer of type `jmp_buf` used to store the program’s environment at the point of the call for later restoration by `longjmp`.
Saves the program's current execution state, including the stack pointer, program counter, and registers, into the `jmp_buf` provided in `env`. Returns `0` when returning directly from the `setjmp` call and a nonzero value when returning via `longjmp`.
The setjmp function return value :
  • Returns 0 if returning directly, and a non-zero value if returning from a call to longjmp

Output

This example demonstrates the basic usage of setjmp and longjmp. The setjmp call saves the context, and longjmp later returns to that point.