GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

C character classification

C character classification is a group of operations in the C standard library that test a character for membership in a particular class of characters, such as alphabetic characters or control characters. Both single-byte and wide characters are supported. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

C character classification is a group of operations in the C standard library that test a character for membership in a particular class of characters, such as alphabetic characters or control characters. Both single-byte and wide characters are supported. ('A' Eventually, the interface to common character classification functionality was codified in the C standard library file ctype.h. define isdigit(c) ((c) >= '0' && (c) This can lead to an error when the macro parameter x is expanded to an expression with a side effect; for example: isdigit(x++) . If the implementation was a function, then x would be incremented only once. But for this macro definition it is incremented twice. To eliminate this problem, a common implementation is for the macro to use table lookup. For example, the standard library provides an array of 256 integers one for each character value that each contain a bit-field for each supported classification. A macro references an integer by character value index and accesses the associated bit-field. For example, if the low bit indicates whether the character is a digit, then the isdigit macro could be written as: define isdigit(c) (TABLE[c] & 1) The macro argument, c , is referenced only once, so is evaluated only once. ==References== ==External links==

source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"C character classification". 1766185267. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1328454953

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·