Why is hexadecimal used?

"In programming it is sometimes easier to use hexadecimal or octal"

How is it easier/what advantages does it offer in some situations over decimal?
Last edited on
For example it is very useful when creating bit handling (very often OR'd, not always; look SDL for example). You can divide each of "digits" of hex easily to binary by using following "table"
bin|hex
0000|0
0001|1
0010|2
0011|3
0100|4
0101|5
0110|6
0111|7
1000|8
1001|9
1010|A
1011|B
1100|C
1101|D
1110|E
1111|F

So for example "number" in hex 2A in binary would be (2 "+" A from table): 0010 1010.
Last edited on
563452, what is the 12th bit from right to left?
0xF45CD8, what is the 12th bit, from right to left? It's a 1. For the first example, you have to convert to either binary, octedecimel, or hexidecimel. Binary is a bit much when it's large numbers.

Edit: a huge one right here: in 24 bit rgb format, 0xff00ff, quickly and easily see that there is no green, whereas the same value in decimal would be 16711935. Good luck seeing there is no green in that.
Last edited on
that was funny Intrexa... :)
Topic archived. No new replies allowed.