<tt>int atoi(char *s)</tt>




Document: The C Standard Library

next long atol(char *s)
up Utility Functions: stdlib.h
gif Utility Functions: stdlib.h

int atoi(char *s)

This takes a string representation of an integer (i.e. a string something like "145" or "-9999" or "000000" etc.) and converts it into the corresponding internal representation of type int, which is the return value from the function.

The conversion will ignore any trailing data in the string (e.g. "143yu*" gets converted as 123).

The behaviour where the answer would overflow (i.e. be greater than INT_MAX or less than INT_MIN) is generally unpredictable or indeterminate - so it is your responsibility to make sure this never arises; if the conversion simply cannot be done (e.g. atoi("xyz") the return value will be 0.




Document: The C Standard Library

next long atol(char *s)
up Utility Functions: stdlib.h
gif Utility Functions: stdlib.h



McMullin@eeng.dcu.ie
Fri Mar 29 14:35:38 GMT 1996