-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_atoi.c
executable file
·26 lines (23 loc) · 1.04 KB
/
ft_atoi.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fulldemo <fulldemo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/06 17:02:14 by fulldemo #+# #+# */
/* Updated: 2019/12/13 16:53:03 by fulldemo ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_atoi(const char *str)
{
int nb;
nb = 0;
while (*str >= '0' && *str <= '9')
{
nb = nb * 10 + (*str - '0');
str++;
}
return (nb);
}