On Mon, Dec 30, 2019 at 11:24 PM Doug McIlroy <doug(a)cs.dartmouth.edu> wrote:
The use of %% to designate a literal % in printf is
not
a recent convention. It was defined in K&R, first edition.
FWIW, I still have an old (fading) copy of the galley proofs for the first
edition. Page 147 (*Chapter 7 - Input and Output, Section 7.3 Formatted
Output - Printf*) first full paragraph on the page:
If the character after the % is not a conversion character, that character
is printed: thus % may be printed by %%.
Doug
Ralph Cordery wrote:
Though that may seem odd to our modern C-standardised eyes, it's
understandable in that if it isn't a valid %f, etc., format specifier
then it's a literal percent sign.