-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_getnbr.c
31 lines (27 loc) · 1.1 KB
/
ft_getnbr.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
27
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_getnbr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dhorvill <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/01/03 15:47:51 by dhorvill #+# #+# */
/* Updated: 2018/01/03 15:54:36 by dhorvill ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
int ft_get_nbr(char *nbr)
{
int i;
int j;
i = -1;
j = 0;
while (nbr[++i])
j = j * 10 + (nbr[i] - '0');
return (j);
}
int main(int argc, char **argv)
{
printf("%i\n", ft_get_nbr(argv[1]));
return (0);
}