This commit is contained in:
Camille Chauvet 2023-01-19 17:30:22 +01:00
parent 4a5f0db72a
commit 13d20d0ed0

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/08 18:43:06 by cchauvet #+# #+# */ /* Created: 2022/11/08 18:43:06 by cchauvet #+# #+# */
/* Updated: 2022/12/11 17:49:49 by cchauvet ### ########.fr */ /* Updated: 2023/01/19 17:28:17 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -27,11 +27,11 @@ int ft_isnum(char *str)
return (0); return (0);
while (*str != '\0') while (*str != '\0')
{ {
i = i * 10 + *str - '0';
if (i * sign > INT_MAX || INT_MIN > i * sign) if (i * sign > INT_MAX || INT_MIN > i * sign)
return (0); return (0);
if (!(*str >= '0' && *str <= '9')) if (!(*str >= '0' && *str <= '9'))
return (0); return (0);
i = i * 10 + *str - '0';
str++; str++;
} }
return (1); return (1);