0
0

Add all git folders

This commit is contained in:
Baco
2021-08-15 23:30:40 +02:00
parent 0abd1f86bc
commit a808b91a50
123 changed files with 2391 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/13 12:46:22 by gbaconni #+# #+# */
/* Updated: 2021/08/13 14:58:30 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
int ft_atoi(char *str)
{
int nb;
int s;
int i;
nb = 0;
s = 0;
i = 0;
while (str[i] != '\0')
{
if (str[i] == ' ' || (str[i] >= '\t' && str[i] <= '\r'))
s += 0;
else if (str[i] == '+')
s++;
else if (str[i] == '-')
s--;
else if (str[i] >= '0' && str[i] <= '9')
nb = nb * 10 + str[i] - '0';
else
break ;
i++;
}
if (s < 0)
nb *= -1;
return (nb);
}