/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_atoi.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cchauvet int ft_atoi(const char *str) { int out; char sign; size_t i; sign = 1; i = 0; while (str[i] == '-' || str[i]== '+') { if (str[i] == '-') sign = -1; if (str[i] == '+') sign = 1; i++; } out = 0; while (str[i] >= '0' && str[i] <= '9') { out = out * 10 + str[i] - 48; i++; } return (out * sign); }