by nuxi · 15y ago · 0 comments
It does have a clear behaviour, but it's possibly different from what you think. From your examples I'm assuming "c" is a char variable - since you're casting it to int in the second example - which is then (incorrectly) passed to printf with "%c". Both %c and %d require an integer parameter, so "c" should be an integer to begin with (thus no need for a cast).
Nitpicking, I know, but such code can lead to many subtle bugs.
So the original code is correct, my reply wasn't.