segfaults have been eliminated
This commit is contained in:
27
libft/srcs/ft_isnumeric.c
Normal file
27
libft/srcs/ft_isnumeric.c
Normal file
@@ -0,0 +1,27 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_isnumeric.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mndhlovu <mndhlovu@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/26 10:17:04 by mndhlovu #+# #+# */
|
||||
/* Updated: 2019/04/26 10:35:46 by mndhlovu ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
int ft_isnumeric(char *str)
|
||||
{
|
||||
int index;
|
||||
|
||||
index = 0;
|
||||
while (str[index] != '\0')
|
||||
{
|
||||
if (!ft_isdigit(str[index]))
|
||||
return (0);
|
||||
index++;
|
||||
}
|
||||
return (1);
|
||||
}
|
Reference in New Issue
Block a user