C Language Multi-Character Character Sequence Digraphs



In 1994 more readable alternatives to five of the trigraphs were supplied. These use only two characters and are known as digraphs. Unlike trigraphs, digraphs are tokens. If a digraph occurs in another token (e.g. string literals or character constants) then it will not be treated as a digraph, but remain as it is.

The following shows the difference before and after processing the digraphs sequence.

#include <stdio.h>

int main()
    printf("Hello %> World!\n"); /* Note that the string contains a digraph */

Which will be treated the same as:

#include <stdio.h>

int main()
    printf("Hello %> World!\n"); /* Note the unchanged digraph within the string. */