
24 Mar
2004
24 Mar
'04
2:33 p.m.
unsigned char x = 0xC2;
printf("this is the problem %02X\n", x);
result is:
this is the problem FFFFFFFC2
This is a compiler issue. You told the compiler that x was of type unsigned char and it ignored you. When x was converted to an argument, the compiler treated it as signed. Once x gets sign extended, there's no way for the printf function to know.
Regards, Charlie
7713
Age (days ago)
7713
Last active (days ago)
0 comments
1 participants
participants (1)
-
Wells, Charles