#include <stdio.h>
int	ft_atoi(char *str)
{
	int	s;
	int	r;

	s = 1;
	r = 0;
	while (*str > '9')
		break ;
	while (*str < 42)
	    *str++;
	while (*str == '-' || *str == '+')
	{
	    if(*str== '-')
		    s = s * (-1);
		str++;
	}
	while (*str >= '0' && *str <= '9')
	{
		r = r * 10 + (*str - 48);
		str++;
	}
	return (r * s);
}
int main() {
    char s[] = "--+-54321";
    printf("%d\n", ft_atoi(s));
    return 0;
}

Embed on website

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