The code is fully standard compliant to any version of the C standard. The ??
mechanism is called trigraphs and was introduced to C to allow an alternative way of printing certain symbols. It looks like the program was written as a demonstration of various trigraph sequences.
Back in the days, many computers and their keyboards were based on an old symbol table called ISO 646 which didn't contain all symbols used in the C language, such as \ { } [ ]
. This made it impossible for programmers from some countries to even write C, because their national keyboard layout lacked the necessary symbols. Instead of remaking the keyboards and symbol tables, the C language was changed.
Therefore trigraphs were introduced. Today they are considered a completely obsolete feature and it is not recommended to use them.[1] GCC will for example give you a warning if you use them. Still, they remain in the C standard for backwards-compatibility and all C compilers must support them.
The existing trigraph sequences are (C11 5.2.1.1 Trigraph sequences):
??= #
??( [
??/ \
??) ]
??' ^
??< {
??! |
??> }
??- ~
The left column is the trigraph sequence and the right column is its meaning.
EDIT: Those interested in the historical decisions can read about it themselves in the C rationale v5.10, chapter 5.2.1.1.
[1]: C23 removed trigraphs from the language standard entirely.