3.2.1 Char or AnsiChar

Free Pascal supports the type Char. A Char is exactly 1 byte in size, and contains one ASCII character.

A character constant can be specified by enclosing the character in single quotes, as follows : ’a’ or ’A’ are both character constants.

A character can also be specified by its character value (commonly an ASCII code), by preceding the ordinal value with the number symbol (#). For example specifying #65 would be the same as ’A’.

Also, the caret character (^) can be used in combination with a letter to specify a character with ASCII value less than 27. Thus ^G equals #7 - G is the seventh letter in the alphabet. The compiler is rather sloppy about the characters it allows after the caret, but in general one should assume only letters.

When the single quote character must be represented, it should be typed two times successively, thus ’’’’ represents the single quote character.

To distinguish Char from WideChar, the system unit also defines the AnsiChar type, which is the same as the char type. In future versions of FPC, the Char type may become an alias for either WideChar or AnsiChar.