-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_atonbr.c
More file actions
32 lines (29 loc) · 1.09 KB
/
ft_atonbr.c
File metadata and controls
32 lines (29 loc) · 1.09 KB
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
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atonbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fokrober <fokrober@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/23 05:44:01 by fokrober #+# #+# */
/* Updated: 2019/04/23 14:15:22 by fokrober ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_atonbr(char *s)
{
int n;
int signe;
n = 0;
signe = 1;
if (*s == '-')
{
signe = -1;
s++;
}
while (ft_todigit(*s) != -1)
{
n = (10 * n) + ft_todigit(*s++);
}
return (n * signe);
}