wctype(3)

๐Ÿ’– wctype(3) โ€” the wide-char vibe check function ๐Ÿ’–

okay bestie, so we're in section 3 of the manual, which means we're talking library functions, and today's main character is wctype. she lives in the Standard C library (libc, link with -lc when you're compiling, mwah). let's get into it ๐Ÿฆ‹


โœจ SYNOPSIS โœจ

#include <wctype.h>

wctype_t wctype(const char *name);

that's it. one function, one const char *, she's lowkey simple but she's doing so much for us ๐Ÿซถ


๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay so first let's talk about the type, because wctype_t is the whole point.

wctype_t represents a property that a wide character might or might not have. like, it's a whole class of wide characters, not one specific character. and here's the tea: what this type actually is on the inside is implementation-dependent โ€” nobody's promising you it looks any particular way. BUT. there's one thing everyone agrees on:

the special value (wctype_t) 0 means "invalid property". that's the zero. it's the "no thanks". it's the ick.

and any nonzero wctype_t value can be handed straight to iswctype(3) to actually test whether some given wide character has that property. so wctype() is like โ€” you ask for the property, iswctype() is the one who checks whether your character qualifies. they're a duo fr fr ๐Ÿ‘‘

So, the actual function: wctype() returns a property, and you get to pick it by name. which names are valid? that depends on the LC_CTYPE category of your current locale โ€” locale-dependent, as always, she's dramatic like that. BUT these following names are valid in every single locale, no cap:

  • "alnum" โ€” realizes the isalnum(3) classification function โœจ
  • "alpha" โ€” realizes the isalpha(3) classification function โœจ
  • "blank" โ€” realizes the isblank(3) classification function โœจ
  • "cntrl" โ€” realizes the iscntrl(3) classification function โœจ
  • "digit" โ€” realizes the isdigit(3) classification function โœจ
  • "graph" โ€” realizes the isgraph(3) classification function โœจ
  • "lower" โ€” realizes the islower(3) classification function โœจ
  • "print" โ€” realizes the isprint(3) classification function โœจ
  • "punct" โ€” realizes the ispunct(3) classification function โœจ
  • "space" โ€” realizes the isspace(3) classification function โœจ
  • "upper" โ€” realizes the isupper(3) classification function โœจ
  • "xdigit" โ€” realizes the isxdigit(3) classification function โœจ

twelve of them, all iconic, all present everywhere. slay ๐Ÿ’…


๐ŸŽ€ RETURN VALUE ๐ŸŽ€

  • if the name you passed is valid โ†’ you get a property descriptor back. congratulations, she ate ๐Ÿ“
  • otherwise โ†’ you get (wctype_t) 0. aka the invalid-property value. aka the void. aka not me getting zero again ๐Ÿ˜ญ

๐Ÿ‘‘ ATTRIBUTES ๐Ÿ‘‘

for an explanation of the terms used in this section, go peek at attributes(7). ๐Ÿ’œ

  • Interface: wctype()
    • Attribute: Thread safety
    • Value: MT-Safe locale

so like, thread-safe, but locale-thread-safe, iykyk โ€” the locale part is doing work in that sentence. ๐ŸŒˆ


๐ŸŒŸ STANDARDS ๐ŸŒŸ

C11, POSIX.1-2008. certified, blessed, official. periodt. โœ…


๐Ÿงš HISTORY ๐Ÿงš

POSIX.1-2001, C99. so she's been around, she's a legacy icon, she predates most of us knowing what a locale even is ๐Ÿ’€


โญ NOTES โญ

the behavior of wctype() depends on the LC_CTYPE category of the current locale.

read that again bestie. it depends on the current locale. change your locale, change what names work. it's giving main character energy with a mood ring. ๐Ÿ™ˆ

๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

  • iswctype(3) โ€” the other half of the duo ๐Ÿ’ž

and that's the whole thing! this page came to you courtesy of Linux man-pages 6.20, dated 2026-02-08 โ€” okay love you bye, go classify some wide characters responsibly ๐Ÿ’–โœจ๐ŸŽ€

๐Ÿ“ฆ 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: GPL-2.0-or-later
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms