-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_isdigit.c
44 lines (39 loc) · 1.44 KB
/
ft_isdigit.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isdigit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ledias-d <[email protected]> #+# +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024-10-11 12:54:59 by ledias-d #+# #+# */
/* Updated: 2024-10-11 12:54:59 by ledias-d ### ########.rio */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_isdigit(int c)
{
if (c >= 48 && c <= 57)
return (1);
else
return (0);
}
/*#include <stdio.h>
void test_ft_isdigit(int c) {
int result = ft_isdigit(c);
if (result != 0)
printf("ft_isdigit(%c) = %d: Passou\n", c, result);
else
printf("ft_isdigit(%c) = %d: Falhou\n", c, result);
}
int main(void)
{
test_ft_isdigit('0');
test_ft_isdigit('5');
test_ft_isdigit('9');
test_ft_isdigit('a');
test_ft_isdigit('Z');
test_ft_isdigit('!');
test_ft_isdigit(-3);
test_ft_isdigit(128);
return 0;
}*/