#include <stdio.h>

int	ft_atoi(char *str)
{
	int	i;
	int	sign;
	int	result;
	int	count;

	i = 0;
	sign = 1;
	result = 0;
	count = 0;
	while (str[i] == 32 || (str[i] >= 9 && str[i] <= 13))
		i++;
	while (str[i] == '-' || str[i] == '+')
	{
		if (str[i] == '-')
		{
			sign = sign * -1;
			count++;
			if (count >= 2)
				return (0);
		}
		i++;
	
	}
	while (str[i] >= '0' && str[i] <= '9')
	{
		result = result * 10 + (str[i] - '0');
		i++;
	}
	return (result * sign);
}

int	main(void)
{
	char	str[] = " 	+-+++++1234ab567";
	printf("%d", ft_atoi(str));
	return (0);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: