int	ft_str_is_numeric(char *str)
{
	int	i;

	i = 0;
	while (str[i] != '\0')
	{
		if (str[i] <= 47 || str[i] >= 58)
		{
			return (0);
		}
		++i;
	}
	return (1);
}

/*
#include <stdio.h>

int main(void)
{
    // ici que alphabet alors retourn 1
    int result1;
    char str1[] = "12345646";
    result1 = ft_str_is_numeric(str1);
    printf("La chaîne est-elle uniquement compose de chiffres ? %d\n", result1);
 
    // ici alphabet et autres caractères donc retourne 0
    char str2[] = "A$1Ph48Et$";
    int result2 = ft_str_is_numeric(str2);
    printf("La chaîne est-elle uniquement compose de chiffres ? %d\n", result2);

    // ici test du vide donc retourne 1
    char str3[] = "";
    int result3 = ft_str_is_numeric(str3);
    printf("La chaîne est-elle uniquement compose de chiffres ? %d\n", result3);

    return 0;
}*/

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: