Yes, and no. Despite what some other replies have said, the C compiler is required to perform conversions for sprintf()
, and all other variadic functions, as follows:
char
=> int
short
=> int
float
=> double
(and signed/unsigned variants of the above integral types)
It does this precisely because sprintf()
(and the other print()
-family functions) would be unusable without it. (Of course, they're pretty unusable as it is.)
But you cannot assume any other conversions, and your code will have undefined behaviour - read: crash! - if you do it.