diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-07-07 15:29:30 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-07-07 15:29:30 +0200 |
| commit | a2ef228b981df5ad417a0e8377e1e832002a7644 (patch) | |
| tree | 32827b5be808bf3123d46856bb753fc190fd3611 /c04/ex02 | |
| parent | 79f8ba0b777f3361002ed2ae0c6c6f8f353ca731 (diff) | |
| download | piscine-a2ef228b981df5ad417a0e8377e1e832002a7644.tar.gz piscine-a2ef228b981df5ad417a0e8377e1e832002a7644.tar.bz2 piscine-a2ef228b981df5ad417a0e8377e1e832002a7644.zip | |
c04/c05 testing + c06
Diffstat (limited to 'c04/ex02')
| -rw-r--r-- | c04/ex02/ft_putnbr.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/c04/ex02/ft_putnbr.c b/c04/ex02/ft_putnbr.c index 4ba6a0e..020dfa6 100644 --- a/c04/ex02/ft_putnbr.c +++ b/c04/ex02/ft_putnbr.c @@ -6,7 +6,7 @@ /* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/07/06 07:24:04 by cacharle #+# #+# */ -/* Updated: 2019/07/06 08:47:01 by cacharle ### ########.fr */ +/* Updated: 2019/07/06 15:09:46 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,21 +19,21 @@ void ft_putchar(char c) void ft_putnbr(int nb) { - int i; + int i; int rev_digits[100]; unsigned int nbu; if (nb == 0) { ft_putchar('0'); - return; + return ; } + nbu = nb; if (nb < 0) { ft_putchar('-'); nbu = -nb; - } else - nbu = nb; + } i = 0; while (nbu > 0) { @@ -42,8 +42,5 @@ void ft_putnbr(int nb) i++; } while (i > 0) - { - i--; - ft_putchar(rev_digits[i] + '0'); - } + ft_putchar(rev_digits[--i] + '0'); } |
