On this page
isalpha
Prev: isdigit | Up: ctype.h | Next: isspace
Rel: ctype.h, Arrays & C Strings
Ref: cppreference — isalpha
Tags: #public #prog #c #stdlib #ctype #tier/core
Include
#include <ctype.h>
Signature & Overview
int isalpha(int ch);
Returns non-zero if ch is an alphabetic character (also isalnum).
Notes & Pitfalls
- Always cast
charto(unsigned char): Passing a negative signedchar(e.g., UTF-8 byte0xC3) toisalpha()is Undefined Behavior!
Example
#include <assert.h>
#include <ctype.h>
int main(void) {
assert(isalpha((unsigned char)'Z') != 0);
assert(isalpha((unsigned char)'9') == 0);
}
Linked from
Related notes
- tuts/c/stdlib/ctype/isdigit Linked here; links to this page; shared tags: #c, #ctype, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isspace Linked here; links to this page; shared tags: #c, #ctype, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype Linked here; links to this page; shared tags: #c, #ctype, #prog, #stdlib
- tuts/c/fundamentals/arrays_and_strings Linked here; shared tags: #c, #prog
- tuts/c/stdlib/ctype/tolower shared tags: #c, #ctype, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/static_assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/errno/errno shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/limits/CHAR_BIT shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/limits/DBL_EPSILON shared tags: #c, #prog, #stdlib, #tier