diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-29 19:54:12 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-29 19:54:12 +0200 |
commit | 5ef27d97f1dc36b4e9dd2420ba25166e370913d1 (patch) | |
tree | 05fe79b148c750a30c3f0149e933cb3ebc211738 /libft/src/ft_uitoa_base.c | |
parent | Update (diff) | |
download | 42-minishell-5ef27d97f1dc36b4e9dd2420ba25166e370913d1.tar.gz 42-minishell-5ef27d97f1dc36b4e9dd2420ba25166e370913d1.tar.bz2 42-minishell-5ef27d97f1dc36b4e9dd2420ba25166e370913d1.tar.xz 42-minishell-5ef27d97f1dc36b4e9dd2420ba25166e370913d1.tar.zst 42-minishell-5ef27d97f1dc36b4e9dd2420ba25166e370913d1.zip |
End
Diffstat (limited to 'libft/src/ft_uitoa_base.c')
-rw-r--r-- | libft/src/ft_uitoa_base.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libft/src/ft_uitoa_base.c b/libft/src/ft_uitoa_base.c index a931d29..fd9e9a4 100644 --- a/libft/src/ft_uitoa_base.c +++ b/libft/src/ft_uitoa_base.c @@ -13,8 +13,7 @@ #include <libft.h> #include <stdlib.h> -char - *ft_uitoa_base(unsigned long n, char *base) +char *ft_uitoa_base(unsigned long n, char *base) { char *s; unsigned long nb; @@ -23,7 +22,7 @@ char i = ft_uintlen_base(n, base) - 1; if (!(s = (char*)malloc((i + 2) * sizeof(char)))) return (NULL); - if (!n) + if (n == 0) s[i] = '0'; s[i + 1] = '\0'; while (n > 0) |