atoi, atol, atoll

< c‎ | string‎ | byte
Revision as of 17:24, 2 November 2012 by P12bot (Talk | contribs)

Template:ddcl list begin <tr class="t-dsc-header">

Defined in header <stdlib.h>

<td></td> <td></td> <tr class="t-dcl ">

<td class="t-dcl-nopad">
int       atoi( const char *str );

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td class="t-dcl-nopad">
long      atol( const char *str )

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
long long atoll( const char *str );

<td class="t-dcl-nopad"> </td> <td > (since C99) </td> </tr> Template:ddcl list end

Interprets an integer value in a byte string pointed to by str.

Function discards any whitespace characters until first non-whitespace character is found. Then it takes as many characters as possible to form a valid integer number representation and converts them to integer value. The valid integer value consists of the following parts:

  • (optional) plus or minus sign
  • numeric digits



str - pointer to the null-terminated byte string to be interpreted

Return value

Integer value corresponding to the contents of str on success. If the converted value falls out of range of corresponding return type, the return value is undefined. If no conversion can be performed, 0 is returned.


See also

Template:c/string/byte/dcl list strtolTemplate:c/string/byte/dcl list strtoul
C++ documentation for atoi, atol, atoll