ft_atoi - kibotrel/42-Libft GitHub Wiki

int     ft_atoi(char *str)

Description :

Converts a string into an integer. It first skips set characters considered "blank" and then convert the following portion until it reaches either a non numeric character or the string's end.

Return Value :

Starting from the first sign +, - or the first numeric character it calculates the string's integer equivalent. If two signs or more happen at the beginning of the string, 0 is returned. Moreover, after the conversion if the number is less than LONG_MIN, the value will be 0 and -1 over LONG_MAX.

Source code