diff --git a/ft_printf.c b/ft_printf.c index c2f6be9..c6ff56a 100644 --- a/ft_printf.c +++ b/ft_printf.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/12 16:27:59 by erey-bet #+# #+# */ -/* Updated: 2022/11/21 19:14:36 by erey-bet ### ########.fr */ +/* Updated: 2022/11/22 22:53:10 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -67,10 +67,12 @@ int ft_printf(const char *str, ...) int i; int count; + if (str == NULL) + return (-1); va_start(args, str); - i = 0; + i = -1; count = 0; - while (str[i]) + while (str[++i]) { if (str[i] == '%' && ft_is_format(str[i + 1])) { @@ -82,7 +84,6 @@ int ft_printf(const char *str, ...) ft_putchar(str[i]); count++; } - i++; } va_end(args); return (count);