Mail Archives: djgpp/2000/01/24/06:41:41
On Sun, 23 Jan 2000, David Cleaver wrote:
> fprintf(out, "%#x", array0[looper1][looper2]);
> where array0 contains unsigned char's
>
> Anyway, does the compiler actually think that 0xf is the same as 0x0f?
> I personally think it should print out the leading zero
If you want the leading zero, use "%#0x" as your format specifier.
`fprintf' cannot know what do you want it to do except by looking at
the format specifier that you provide.
> So, would the compiler be able to recognize if I chaged the array:
> from {0xf, 0xf, 0x1, 0x7} to {0xff17}?
You are mixing two different things: how a value of a 8-bit byte is
printed, and how it is packed into a 32-bit int. A value of 0xf (15 in
decimal) can still occupy 8 bits, even if 4 bits are enough to express
the value of 15.
- Raw text -