Why does this hex value get output as a negative number?

Posted by bstullkid on Stack Overflow See other posts from Stack Overflow or by bstullkid
Published on 2010-04-23T16:04:55Z Indexed on 2010/04/23 16:23 UTC
Read the original article Hit count: 194

Filed under:
|
char buffer_b[5] = { 0xDA, 0x00, 0x04, 0x00, 0x07 };
printf("%d\n%d\n%d", buffer_b[0], buffer_b[2], buffer_b[4]);

This gives me output:

-38
4
7

However I am expecting:

218
4
7

Thanks.

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++