#include <stdio.h>
int ft_atoi(char *str)
{
    int result = 0;
    int index = 0;
    int sign = 1;
    while (str[index] != '\0' && str[index] < '0' && str[index] > '9')
    {
        sign = sign * (-1);
        index++;
    }
    index = 0;
    while (str[index] != '\0' && str[index] > '0' && str[index] < '9')
    {
        result = result * 10 + (str[index] - 48);
        index++;
    }
    return (result * sign);
}
int main() {
    char *str = "-5465";
    printf("%d\n", ft_atoi(str));
    return 0;
}

Embed on website

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