Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : strtold

long doublestrtold(const char * nptr,char ** endptr) ;

Return Type : long double

A floating-point type with extended precision, typically larger than `double` and used for high-precision arithmetic. The size and precision depend on the platform but are often 80 or 128 bits.
Read about return values of strtold function .

1st Parameter Type : const char *

Pointer to read-only string

1st Parameter

Pointer to the null-terminated string to be converted to a `long double`.

2nd 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.

2nd Parameter

Pointer to a `char *` that will store the address of the first invalid character after the number in `nptr`. Can be `NULL` if this information is not needed.

Read more about parameters of strtold in parameters section
The strtoldfunction in C language Converts the initial portion of the string to a long double.
The strtold function converts the initial part of the string in nptr to a long double value. It skips leading whitespace, converts the subsequent characters as part of the number, and stops at the first character it cannot recognize as part of a number. This function provides the highest precision among the string-to-float conversion functions in C.
The strtoldfunction takes 2 parameters:
  • const char * `nptr`: Pointer to the null-terminated string to be converted to a `long double`.
  • char ** `endptr`: Pointer to a `char *` that will store the address of the first invalid character after the number in `nptr`. Can be `NULL` if this information is not needed.
Converts the initial portion of the string pointed to by `nptr` to a `long double`. The conversion stops at the first invalid character. If `endptr` is not NULL, it points to the character following the valid number. Returns the converted value or `HUGE_VAL`, `-HUGE_VAL`, or `0` on overflow, underflow, or invalid input, respectively.
The strtold function return value :
  • Returns the converted long double value
  • If no conversion could be performed, 0
  • 0 is returned
  • If the correct value is outside the range of representable values, HUGE_VALL (with the correct sign) is returned and errno is set to ERANGE

Output

This example demonstrates basic usage of strtold to convert a string to a long double and identify the remainder of the string.