### atoll -- Convert Character String to Long Long Integer

Format

>     #include <stdlib.h>
>     long long int atoll(const char *string);

Language Level: Extension
atoll converts a character string to a long long value.

The input string is a sequence of characters that can be interpreted as a numerical value of the specified return type. The function stops reading the input string at the first character that it cannot recognize as part of a number; this character can be the null character that ends the string.

atoll does not recognize decimal points nor exponents. The string argument for this function has the form:

where whitespace consists of the same characters for which the isspace function is true, such as spaces and tabs. atoll ignores leading white-space characters. digits is one or more decimal digits.

Return Value
atoll returns a long long value produced by interpreting the input characters as a number. The return value is 0LL if the function cannot convert the input to a value of that type. The return value is undefined in case of overflow.

Example
This example shows how to convert numbers stored as strings to numerical values using the atoll function.

    #include <stdio.h>
    #include <stdlib.h>

    int main(void)
    {
        long ll;
        char *s;

        s = "98854 dollars";
        ll = atoll(s);     /* ll = 98854 */
        printf("atoll ( %s ) = %d\n", s, ll);
        return 0;

       /***************************************
          The output should be similar to:

          atoll( 98854 dollars ) = 98854
       ***************************************/
    }

atof -- Convert Character String to Float
atoi -- Convert Character String to Integer
_atold -- Convert Character String to Long Double
atol -- Convert Character String to Long Integer
strtod -- Convert Character String to Double
strtol -- Convert Character String to Long Integer
strtold -- Convert String to Long Double
<stdlib.h>