Node:The char type, Next:, Previous:Integer variables, Up:Integer variables



The char type

char is a special integer type designed for storing single characters. The integer value of a char corresponds to an ASCII character. For example, a value of 65 corresponds to the letter A, 66 corresponds to B, 67 to C, and so on.

As in the table above, unsigned char permits values from 0 to 255, and signed char permits values from -127 (or -128) to 127. The char type is signed by default on some computers, but unsigned on others. (See Character conversion table. See Special characters.)

char is used only within arrays; variables meant to hold one character should be declared int. (See Strings, for more information on character arrays. See Cast operator demo, for an example of how to use an integer variable to hold a character value.)