Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Hex

Status
Not open for further replies.

WTL

MIS
Jul 4, 1999
5
CA
Why are values sometimes assigned to variables in Hexadecimal. 0xFFFF? What is the benefit of this?<br>
<br>
Thanks for the response.
 
Mostly it makes teh visual represention of the bits easier to see. Example is when entering rgb colors, 0x00c0c0c0 is easy to visulize as grey each byte has an equal value or 0x00808080, a darker shade of grey. 0x00ff0000 is pure red whereas the same thing in decimal 16711680 provides no clue.<br>
<br>
A long value is four bytes. Each byte is a hex nibble or two hex characters. This way it is easy to see that in 0x0000ff00 has all bits of the second byte on.<br>
<br>
It also represents numbers irrespective of sign. 0xffffffff means all bits are set, regardless if you interpret as a signed number ( -1 ) or as an unsigned long ( 4294967295 )<br>
<br>
HTH
 
I agree with NullTerminator.<br>Siddhartha Singh<br><A HREF="mailto:ssingh@aztecsoft.com">ssingh@aztecsoft.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top