Scroll Down to See All▾
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1ynFunction Details : atoi
intatoi(const char * str) ;
Return Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of atoi function .
1st Parameter Type : const char *
Pointer to read-only string
1st Parameter
Pointer to a null-terminated string representing an integer value
Read more about parameters of atoi in parameters section
The atoifunction in C language Converts a string to an integer.
It skips any whitespace characters at the beginning of the string, then takes an optional plus or minus sign followed by as many base-10 digits as possible, and interprets them as a numerical value. The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function.
Important: atoi function does not recognize decimal point as it , but rather treats it as any other non-digit character and breaks the loop.
Important: atoi function does not recognize decimal point as it , but rather treats it as any other non-digit character and breaks the loop.
To Summarize the Workflow:
- 1.Takes a string (like "123") as input.
- 2.Scans the string, ignoring leading whitespace.
- 3.If plus or minus sign is present before digits begin- processes it as a sign.
- 4.In case no sign found-sets result to positive as default
- 5.Starts looping over following characters. In case those represent digits-processes digits.
- 6.Stops at the first non-digit character (like a letter or symbol).
- 7.Returns the integer value of the processed digits (e.g., 123).
- 8.If the string doesn’t start with a valid number, it returns 0.
Read more about return type and value ofatoi function in return section.
The atoifunction takes 1
parameter:Converts the initial portion of a string to an `int` value, interpreting the content as a decimal integer.
- •const char * `str`: Pointer to a null-terminated string representing an integer value
The atoi function return value :
- Returns the converted integer value
- If no valid conversion could be performed, it returns 0
Output
This example demonstrates the basic usage of the `atoi` function with different input strings, including a positive number, a negative number with leading whitespace, a number followed by non-numeric characters, and an invalid input.