-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_isascii.c
57 lines (50 loc) · 1.96 KB
/
ft_isascii.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
46
47
48
49
50
51
52
53
54
55
56
57
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isascii.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sperez-p <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/20 12:44:52 by sperez-p #+# #+# */
/* Updated: 2021/08/20 12:44:53 by sperez-p ### ########.fr */
/* */
/* ************************************************************************** */
/*
NAME
****
ft_isascii ---> is a ascii character
SYNOPSIS
***********
#include <ctype.h>
int isascii(int c);
#include "libft.h"
int ft_isascii(int c);
DESCRIPTION
***********
The function ft_isascii() mimics the behavior of the isascii() function from
ctype C library. Both functions check if c is a 7-bit unsigned char value
that fits into the ASCII character set.
PARAMETERS
**********
c ---> The character to be checked.
RETURN VALUE
************
- Non-zero value if c is a digit or a letter.
- Zero value if not.
NOTES
*****
isascii() is a BSD extension and is also an SVr4 extension.
POSIX.1-2008 marks isascii() as obsolete, noting that it cannot be used portably
in a localized application.
*/
/*
RETURN A CONDITION
******************
When we return a condition, the computer will check if the condition is true or
false. If it is true it will return 1(boolean true) and if it is false it will
return 0(boolean false).
*/
int ft_isascii(int c)
{
return (c >= 0 && c <= 127);
}