atol() string to long integer conversion - C-Tutorial

Latest

Saturday, 8 October 2016

atol() string to long integer conversion

atol() function:           atol() function converts a string of digits into a long integer value.  The general format of the atol() function is:


                        Syntax:           long int atol(string);

            Function accepts a string as an argument and returns the result value as a long integer.

/* EXAMPLE PROGRAM FOR atol() FUNCTION*/


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

main()
{
    char a[20] = "100000000000";
    printf(" Value = %ld ", atol(a));

}

No comments:

Post a Comment