In a well-known article by Ken Thompson, ( http://users.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf )
in figure 1, that formats printf with decimal %d
printf("\t%d, \n", s[i]);
Why would that be done? Shouldn't it have been %c with character format? Why not? Was printf different during that time? Which version of C is the one in figure 1 in the article?
charis an integer type, and such printable with format specifiers for integers. Type promotion rules cause it to be converted tointwhen passed on a variadic argument list, which makes%da valid format specifier forchar. Strictly speaking,%hhdis preferred forchar, but this might have not existed back then; this is probably the only part that might be retro-specific. – user3840170 Aug 30 '21 at 11:39