#include <stdlib.h> int atoi(const char *nptr);
(int)strtol(nptr, (char **)NULL, 10)
If successful, atoi() returns the converted int value represented in the string.
If unsuccessful, atoi() returns an undefined value.