atoi() — Convert character string to integer

Format

#include <stdlib.h>

int atoi(const char *nptr);

General description

The atoi() function converts the initial portion of the string pointed to by nptr to a 'int'. This is equivalent to
(int)strtol(nptr, (char **)NULL, 10)

Returned value

If successful, atoi() returns the converted int value represented in the string.

If unsuccessful, atoi() returns an undefined value.

Related Information