Character Representation

Characters are stored in fields of one, two, three, four, six, or eight bits. In the table below, the Character Type column lists the valid ALGOL character types. The Field Size and Bits Used columns show the field size in bits and the number of bits within that field, respectively, that are used for storing each type of character. The Valid Constructs column shows the character-oriented ALGOL constructs that are used to manipulate each character type.

Character Type

Field Size

Bits Used

Valid Constructs

EBCDIC

8

8

Pointer, character array, string, string literal

ASCII

8

7

Pointer, character array, string, string literal

Hexadecimal (HEX)

4

4

Pointer, character array, string, string literal

Octal

3

3

String literal

Quaternary

2

2

String literal

Binary

1

1

String literal

EBCDIC Characters (8-Bit Fields) through Octal Characters (3-Bit Fields) illustrate how the various character types are stored within a data word.

Figure 12. EBCDIC Characters (8-Bit Fields)

EBCDIC Characters (8-Bit Fields)


ASCII Characters (8-Bit Fields) shows that ASCII characters, which are 7-bit characters, are stored in 8-bit fields (as are EBCDIC characters). The zeros shown for bits 7, 15, 23, 31, 39, and 47 indicate that these bits are 0 when ASCII characters are stored.

Figure 13. ASCII Characters (8-Bit Fields)

ASCII Characters (8-Bit Fields)


Figure 14. Hexadecimal Characters (4-Bit Fields)

Hexadecimal Characters (4-Bit Fields)


Figure 15. Octal Characters (3-Bit Fields)

Octal Characters (3-Bit Fields)