Trigraphs (historical)
suggest changeEarly C environments did not always provide every character used by C's syntax. C therefore defined nine three-character sequences, called trigraphs, that were replaced early in translation:
| Trigraph | Replacement |
|---|---|
??= |
# |
??/ |
backslash |
??' |
^ |
??( |
[ |
??) |
] |
??! |
` |
??< |
{ |
??> |
} |
??- |
~ |
Trigraphs were removed from C23. They can still matter when compiling older source in an earlier language mode, and some compilers require a dedicated option to enable or diagnose them.
Because replacement occurred inside comments, character constants, and string literals, an accidental sequence such as ??/ could change line splicing and produce surprising results. Do not introduce trigraphs in new code.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents