Converts a character string to a value of type int.
#include <stdlib.h> int atoi(const char *nptr);
nptr
A pointer to the string to convert.
The atoi() function converts the character array pointed to by nptr to an integer value. Except for its behavior on error, this function is the equivalent of the call
(int)strtol(nptr, (char **)NULL, 10);
This function sets the global variable errno to ERANGE if the converted value cannot be expressed as a value of type int.
atoi() returns an integer value of type int.