isalpha(3)
๐ isalpha(3) โ the character classification girlies ๐
okay bestie, sit down, because this is the page for the entire ctype.h classification squad. The manual name is isalpha but she's literally the spokesmodel for a whole friend group. This is a Library Functions Manual page, and it's giving "we check what KIND of character you are" energy. No cap. ๐ฆ
โจ NAME โจ
isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit, isalnum_l, isalpha_l, isascii_l, isblank_l, iscntrl_l, isdigit_l, isgraph_l, islower_l, isprint_l, ispunct_l, isspace_l, isupper_l, isxdigit_l โ character classification functions ๐
๐ LIBRARY ๐
Standard C library (libc, -lc). The classic. The blueprint. ๐
๐ SYNOPSIS ๐
#include <ctype.h>
int isalnum(int c);
int isalpha(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int isascii(int c);
int isblank(int c);
int isalnum_l(int c, locale_t locale);
int isalpha_l(int c, locale_t locale);
int isblank_l(int c, locale_t locale);
int iscntrl_l(int c, locale_t locale);
int isdigit_l(int c, locale_t locale);
int isgraph_l(int c, locale_t locale);
int islower_l(int c, locale_t locale);
int isprint_l(int c, locale_t locale);
int ispunct_l(int c, locale_t locale);
int isspace_l(int c, locale_t locale);
int isupper_l(int c, locale_t locale);
int isxdigit_l(int c, locale_t locale);
int isascii_l(int c, locale_t locale);
๐ง Feature Test Macro Requirements for glibc (see feature_test_macros(7)): ๐ง
isascii():
_XOPEN_SOURCE
|| /* glibc >= 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _SVID_SOURCE
isblank():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
isalnum_l(), isalpha_l(), isblank_l(), iscntrl_l(), isdigit_l(),
isgraph_l(), islower_l(), isprint_l(), ispunct_l(), isspace_l(),
isupper_l(), isxdigit_l():
Since glibc 2.10:
_XOPEN_SOURCE >= 700
Before glibc 2.10:
_GNU_SOURCE
isascii_l():
Since glibc 2.10:
_XOPEN_SOURCE >= 700 && (_SVID_SOURCE || _BSD_SOURCE)
Before glibc 2.10:
_GNU_SOURCE
๐ธ DESCRIPTION ๐ธ
So here's the tea: these functions check whether c โ which must have the value of an unsigned char or EOF, and yes that matters, we'll get to it โ falls into a certain character class according to the specified locale. The functions without the "_l" suffix do the check based on the current locale.
The functions with the "_l" suffix do the check based on the locale specified by the locale object locale. And heads up, this part is important: the behavior of these functions is undefined if locale is the special locale object LC_GLOBAL_LOCALE (peep duplocale(3)) or if it isn't a valid locale object handle. So don't do that. ๐
The list below explains how the functions without the "_l" suffix work; the "_l" versions differ only in using the locale object locale instead of the current locale.
isalnum()โ checks for an alphanumeric character. It's literally equivalent to(isalpha(c) || isdigit(c)). Two for one. Slay. โจisalpha()โ checks for an alphabetic character. In the standard"C"locale it's equivalent to(isupper(c) || islower(c)). But in some locales there may be additional characters for whichisalpha()is true โ letters that are neither uppercase nor lowercase. Gender is a spectrum and so is casing, apparently. ๐isascii()โ checks whethercis a 7-bitunsigned charvalue that fits into the ASCII character set. Small, humble, only 128 vibes.isblank()โ checks for a blank character; that is, a space or a tab. Just those two. That's the whole list, bestie.iscntrl()โ checks for a control character. The unhinged ones.isdigit()โ checks for a digit (0through9).isgraph()โ checks for any printable character except space. So like, visible, but no room for personal space. no cap.islower()โ checks for a lowercase character.isprint()โ checks for any printable character including space. Space finally gets included, we love an inclusive queen ๐ซถispunct()โ checks for any printable character that is not a space or an alphanumeric character. The punctuation girlies:!?;you know the vibes.isspace()โ checks for white-space characters. In the"C"and"POSIX"locales, these are: space, form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). Six icons. periodt.isupper()โ checks for an uppercase letter.isxdigit()โ checks for hexadecimal digits, that is, one of0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F. Yes, both cases, it's an ally. ๐
๐ซ RETURN VALUE ๐ซ
The values returned are nonzero if the character c falls into the tested class, and zero if not. That's it. Binary. No complicated situationship. ๐
๐ฅ ATTRIBUTES ๐ฅ
For an explanation of the terms used in this section, see attributes(7).
- Interface:
isalnum(),isalpha(),isascii(),isblank(),iscntrl(),isdigit(),isgraph(),islower(),isprint(),ispunct(),isspace(),isupper(),isxdigit()- Attribute: Thread safety
- Value:
MT-Safe๐โจ
(yeah the original had a whole table, it's the same info, enjoy the bullet-point remix ๐)
โญ STANDARDS โญ
isalnum()isalpha()iscntrl()isdigit()isgraph()islower()isprint()ispunct()isspace()isupper()isxdigit()isblank()
โก๏ธ those all be C11, POSIX.1-2008.
isascii()isalnum_l()isalpha_l()isblank_l()iscntrl_l()isdigit_l()isgraph_l()islower_l()isprint_l()ispunct_l()isspace_l()isupper_l()isxdigit_l()
โก๏ธ those be POSIX.1-2008.
isascii_l()
โก๏ธ that one's GNU. Glibc original flavor, iykyk.
๐ฐ๏ธ HISTORY ๐ฐ๏ธ
isalnum()isalpha()iscntrl()isdigit()isgraph()islower()isprint()ispunct()isspace()isupper()isxdigit()
โก๏ธ C89, POSIX.1-2001. Ancient. Elders. Respect them.
isblank()
โก๏ธ C99, POSIX.1-2001.
isascii()
โก๏ธ POSIX.1-2001 (XSI).
โ ๏ธ POSIX.1-2008 marks it as obsolete, noting that it cannot be used portably in a localized application. So she's retired, but she still shows up to the function calls. ๐
isalnum_l()isalpha_l()isblank_l()iscntrl_l()isdigit_l()isgraph_l()islower_l()isprint_l()ispunct_l()isspace_l()isupper_l()isxdigit_l()
โก๏ธ glibc 2.3. POSIX.1-2008.
isascii_l()
โก๏ธ glibc 2.3.
๐ CAVEATS ๐
๐จ THE BIG ONE. The standards require that the argumentcfor these functions is eitherEOFor a value that is representable in the typeunsigned char; otherwise, the behavior is undefined. Not "kinda weird". Undefined. As in, anything can happen, and it will happen to you specifically. ๐ญ
If the argument c is of type char, it must be cast to unsigned char, like this:
char c;
...
res = toupper((unsigned char) c);
This is necessary because char may be the equivalent of signed char, in which case a byte where the top bit is set would be sign extended when converting to int, yielding a value that's outside the range of unsigned char. So the cast isn't โจaestheticโจ, it's load-bearing. ๐ซถ
Also, the details of what characters belong to which class depend on the locale. For example, isupper() will not recognize an A-umlaut (ร) as an uppercase letter in the default C locale. She's uppercase in spirit. ๐
๐ SEE ALSO ๐
iswalnum(3), iswalpha(3), iswblank(3), iswcntrl(3), iswdigit(3), iswgraph(3), iswlower(3), iswprint(3), iswpunct(3), iswspace(3), iswupper(3), iswxdigit(3), newlocale(3), setlocale(3), toascii(3), tolower(3), toupper(3), uselocale(3), ascii(7), locale(7)
and that's the page, bestie!! ๐ this came to you from Linux man-pages 6.20, dated 2026-02-08, and she's isalpha(3) in the Library Functions Manual. go forth and cast your chars to unsigned char. mwah ๐๐โจ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1993, Thomas Koenig <ig25@rz.uni-karlsruhe.de>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms