ft_isalnum

Subject

ISALNUM(3) (simplified)

NAME
    isalnum -- alphanumeric character test
SYNOPSIS
    int isalnum(int c)
DESCRIPTION
    The isalnum() function tests for any character for which isalpha(3) or isdigit(3) is true. The value of the argument must be representable as an unsigned char or the value of EOF.
RETURN VALUES
    The isalnum() function returns zero if the character tests false and returns non-zero if the character tests true.

Understandable explanation

For this function, the man is self-explanatory, but I'll still explain it in other words.

The isalnum() function returns a non-zero value if the character passed as an int parameter is alphabetical or a decimal digit character.

If the character is not alphabetical nor a decimal digit character, the isalnum() function returns 0.

Hints

ft_isalnum.c
int    ft_isalnum(int c)
{
    if (/* c isalpha or c isdigit */)
        return (/* non-zero value of your choice */);
    return (0);
}

Commented solution

ft_isalnum (variant 1)
ft_isalnum (variant 2)

Last updated

Was this helpful?