|
|
#include <stdlib.h>int atoi(const char *str);
The atoi( ) function converts the string pointed to by str into an int value. The string must contain a valid integer number. If this is not the case, the returned value is undefined.
The number can be terminated by any character that cannot be part of an integer number. This includes whitespace, punctuation, and characters. This means that if atoi( ) is called with “123.23”, the integer value 123 will be returned, and the “.23” is ignored.
Related functions are atof( ) and atol( ).
|
|