From 580d3d9325f4105b5448a5f0e5503e6d105c6117 Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Thu, 25 Apr 2024 11:17:47 +0200 Subject: [PATCH] Fix for "0" input to be recognized as valid int --- ft_check/ft_isint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ft_check/ft_isint.c b/ft_check/ft_isint.c index acffdee..09afa3a 100644 --- a/ft_check/ft_isint.c +++ b/ft_check/ft_isint.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/10 12:44:56 by ljiriste #+# #+# */ -/* Updated: 2024/04/10 13:17:33 by ljiriste ### ########.fr */ +/* Updated: 2024/04/25 10:26:24 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -34,7 +34,7 @@ int ft_isint(const char *str) sign *= -1; ++str; } - while (*str == '0') + while (*str == '0' && *(str + 1)) ++str; if (sign == -1) res = !ft_strcmp(str, newstr + 1); -- 2.30.2