Atol() – C Library function Program


Declaration :

Explanation :

Purpose The C library function long int atol(const char *str) converts the string argument str to a long integer (type long int).
Parameters str ===> This is the string containing the representation of an integral number.
Return Value This function returns the converted integral number as a long int. If no valid conversion could be performed it returns zero.
Header File ctype.h
Exception

C Program : Example

See below example of atol() function.

Output :