Ah! Well casting makes everything alright then.
[Not really. The program still doesn't bare any relation to
my statement that in order to be compatible types, two
types must have the same size. Note that compatible type is
a concept that is explicitly defined in the C standard.
Suitability of operands in assignment is a separate issue.]
Why go to all that trouble? Why not just use %i or even
better, %u?
Because they are also wrong. %u will only work if size_t
happens to be an unsigned int, but on the virtual C machine
you cannot assume this.
C99 added a length modifier of z, so size_t can be printed
(and scanned) with %zu. But for C99, a strictly conforming
program must cast the value.