4 ms·
The C library should cast the parameter down to a char when "%c" is used; the only reason it allows an int is for the "%lc" case.
by makecheck 16y ago
The C library should cast the parameter down to a char when "%c" is used; the only reason it allows an int is for the "%lc" case.
- nuxi 16y agoIt does cast it down (to unsigned char). The requirement for int however was is not for "%lc", it was already in C89. I suspect it has to do with default integral promotions for (variadic) function parameters - which I incorrectly disregarded when replying. So the original code is correct, my reply wasn't.