-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_isalnum.c
45 lines (42 loc) · 1.38 KB
/
ft_isalnum.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isalnum.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tiagalex <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/21 14:42:03 by tiagalex #+# #+# */
/* Updated: 2024/10/21 14:42:03 by tiagalex ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
//Verifica se um caractere 'e alfanumerico.
int ft_isalnum(char c)
{
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
{
return (1);
}
else if (c >= '0' && c <= '9')
{
return (2);
}
else
return (0);
}
/*
int main(int argc, char **argv)
{
(void)argc;
if (ft_isalnum(argv[1][0]) == 1)
{
printf("is alphabetic!\n");
}
else if (ft_isalnum(argv[1][0]) == 2)
{
printf("is a digit!\n");
}
else
printf("is nothing!\n");
}
*/