Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : strtok_r

char *strtok_r(char * str,const char * delim,char ** saveptr) ;

Return Type : char *

String pointer (array of characters)
Read about return values of strtok_r function .

1st Parameter Type : char *

String pointer (array of characters)

1st Parameter

Pointer to the null-terminated string to be tokenized. On subsequent calls, this should be `NULL` to continue tokenization of the same string.

2nd Parameter Type : const char *

Pointer to read-only string

2nd Parameter

Pointer to a null-terminated string containing the delimiter characters. These characters separate the tokens in `str`.

3rd Parameter Type : char **

A pointer to a pointer to a null-terminated string. Commonly used in functions like `strtol` and `strtok_r` to store the address of the first invalid character or to maintain state across function calls.

3rd Parameter

Pointer to a `char *` used internally by the function to keep track of the current position in the string between calls.

Read more about parameters of strtok_r in parameters section
The strtok_rfunction in C language A reentrant version of strtok that tokenizes a string into sequences using specified delimiters, storing the context.
The strtok_r function is a reentrant version of strtok. It breaks a string into a sequence of zero or more nonempty tokens. Unlike strtok, it is thread-safe because it uses a user-provided pointer saveptr to maintain context between successive calls that parse the same string.
The strtok_rfunction takes 3 parameters:
  • char * `str`: Pointer to the null-terminated string to be tokenized. On subsequent calls, this should be `NULL` to continue tokenization of the same string.
  • const char * `delim`: Pointer to a null-terminated string containing the delimiter characters. These characters separate the tokens in `str`.
  • char ** `saveptr`: Pointer to a `char *` used internally by the function to keep track of the current position in the string between calls.
A reentrant version of `strtok` that splits the string `str` into tokens using the characters in `delim` as delimiters. On the first call, `str` must be the input string to tokenize. On subsequent calls, `str` should be `NULL`, and the `saveptr` should point to the same variable used in the previous call. Returns a pointer to the next token or `NULL` if there are no more tokens.
The strtok_r function return value :
  • Returns a pointer to the next token, or NULL if there are no more tokens

Output

This example demonstrates basic usage of strtok_r to split a string into tokens based on a delimiter.