Friday, July 29, 2016

C Basics - Trigraph Characters in C

Keyboards used with some platforms were missing some of the special characters. So it was not possible to write C code on these machines. To solve this problem C suggested to use combination of 3 characters to produce a single character called trigraph character.

A trigraph is a sequence of three characters, the first two of which are question marks. The preprocessor replaces all occurrences of trigraph sequences by their single-character equivalents before any other processing. C supports the following 9 trigraph characters.

Trigraph Sequence Equal Character
??= #
??( [
??) ]
??/ \
??< {
??> }
??! |
??’ ^
??- ~

Related topics:
Tokens in C   |   Character Set in C   |   White Space Characters in C   |   Extended Characters in C   |   Escape Sequence in C   |   Comments in C   |   Keywords in C   |   Identifiers in C   |   Declaration in C

List of topics: C Programming

No comments:

Post a Comment