-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_isalnum.c
39 lines (36 loc) · 1.6 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isalnum.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jopedro3 <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/04 11:58:30 by jopedro3 #+# #+# */
/* Updated: 2023/10/04 14:46:36 by jopedro3 ### ########.fr */
/* */
/* ************************************************************************** */
/* Function: ft_isalnum
Purpose: Check if a character is alphanumeric.
How it works:
- Utilizes ft_isalpha and ft_isdigit to check if 'c' is a letter or digit.
- Returns 1 if 'c' is alphanumeric, otherwise 0.
*/
#include "libft.h"
int ft_isalnum(int c)
{
return (ft_isalpha(c) || ft_isdigit(c));
}
/*#include <stdio.h>
int main(void)
{
char test_char1 = 'a';
char test_char2 = '5';
char test_char3 = '!';
printf("Is it '%c' alphanumeric? (Expect 1): %d\n",
test_char1, ft_isalnum(test_char1));
printf("Is it '%c' alphanumeric? (Expect 1): %d\n", test_char2,
ft_isalnum(test_char2));
printf("Is it '%c' alphanumeric? (Expect 0): %d\n", test_char3,
ft_isalnum(test_char3));
return 0;
}*/