Next: , Up: Characters   [Contents][Index]


16.2.1 The char type

The char type is in the C language since the beginning in the 1970ies, but – due to its limitation of 256 possible values – is no longer the adequate type for storing a character.

Technically, it is still adequate in unibyte locales. But since most locales nowadays are multibyte locales, it makes no sense to write a program that runs only in unibyte locales.

ISO C and POSIX standardized an API for characters of type char, in <ctype.h>. This API is nowadays useless and obsolete, when it comes to general text processing.

The important lessons to remember are:

A ‘char’ is just the elementary storage unit for a string, not a character.

Never use <ctype.h>!