Jump to content

Digraphs and trigraphs (programming)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Altenmann (talk | contribs) at 02:51, 16 December 2003 (new). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

A trigraph is a sequence of three characters that represents a single character from the C programming language character set. Trigraphs were introduced by the ANSI Standard to accomodate older computer keyboards that didn't have the required keys or reserved some characters for specific needs. This feature of C language is obsolete today, and many compilers have an option to turn recognition of trigraps on or off.

Trigraphs in the C source code are recognized and substituted with the corresponding character by a C language preprocessor.

A trigraph consisits of two question marks followed by a character. For example, the  ??= trigraph represents the # character.

To enter two question marks, one has to use an escape sequence "\??".