Home > Electronics Tutorials > C Language Tutorial > stdlib.h - String Functions - atoi

C Language Programming Library Reference Guide

stdlib.h - String Functions - atoi

Declaration: int atoi(const char *str); The string pointed to by the argument str is converted to an integer (type int). Any initial whitespace characters are skipped (space, tab, carriage return, new line, vertical tab, or formfeed). The number may consist of an optional sign and a string of digits. Conversion stops when the first unrecognized character is reached.

On success the converted number is returned. If the number cannot be converted, then 0 is returned.

Note: To report broken links or to submit your projects, tutorials please email to Webmaster