October 22, 2024
Chicago 12, Melborne City, USA
C#

Why printf show false value of an hex number


Code

char a; 
a = 0xf1;
printf("%x\n", a);

Output

fffffff1

printf() show 4 bytes, that exactly we have one byte in a.

What is the reason of this misbehavior?

How can I correct it?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video