forked from bridiefranks/42-libft-with-comments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_isalpha.c
34 lines (31 loc) · 1.38 KB
/
ft_isalpha.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isalpha.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bfranks <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/18 14:13:21 by bfranks #+# #+# */
/* Updated: 2022/03/22 12:31:03 by bfranks ### ########.fr */
/* */
/* ************************************************************************** */
/*isalpha() tells you if what you input in the main is in the alphabet (return 1) or not (return 0).
*We compare the int c of interest against the ascii character of 'A' and 'Z'; alternatively, it could
be written as: if (c <= 90 && c >= 65)... where 90 is the ascii value of 'Z'.*/
#include <stdio.h>
#include "libft.h"
int ft_isalpha(int c)
{
if ((c <= 'Z' && c >= 'A') || (c <= 'z' && c >= 'a'))
{
return (1);
}
return (0);
}
int main(void)
{
int a;
a = ft_isalpha('h');
printf("%d\n", a);
return (0);
}