Digraphs and trigraphs
In computer programming, digraphs and trigraphs are sequences of two and three characters, respectively, that appear in source code and, according to a programming language’s specification, should be treated as if they were single characters.
Example
The C preprocessor replaces all occurrences of the nine trigraph sequences in this table by their single-character equivalents before any other processing.
Trigraph | Equivalent |
---|---|
??= | # |
??/ | \ |
??’ | ^ |
??( | [ |
??) | ] |
??! | | |
??< | { |
??> | } |
??- | ~ |
Digraph | Equivalent |
---|---|
<: | [ |
:> | ] |
<% | { |
%> | } |
%: | # |