diff options
Diffstat (limited to '')
-rw-r--r-- | libft/src/ft_itoa_base.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libft/src/ft_itoa_base.c b/libft/src/ft_itoa_base.c index f3abe46..2537161 100644 --- a/libft/src/ft_itoa_base.c +++ b/libft/src/ft_itoa_base.c @@ -11,19 +11,19 @@ /* ************************************************************************** */ #include <libft.h> +#include <inttypes.h> #include <stdlib.h> -char - *ft_itoa_base(long n, char *base) +char *ft_itoa_base(long n, char *base) { char *s; long nb; uint8_t i; i = ft_intlen_base(n, base) - 1; - if (!(s = (char*)malloc((i + 2) * sizeof(char)))) + if ((s = (char*)malloc((i + 2) * sizeof(char))) == NULL) return (NULL); - if (!n) + if (n == 0) s[i] = '0'; if (n < 0) { |