1

Where are these number patterns, Octal and Hex, being used? I read this but I want to know where they are used in programming.

lunix
  • 111
  • 4

2 Answers2

1

The octal and hexadecimal bases are not useful by themselves but are needed as a compact and readable representation of binary numbers. For instance, writing $\text{AB00CDFF}$ is more convenient and less error prone than $10101011000000001100110111111111$.

So the question moves to the usefulness of binary numbers: these enter into play when the internal representation of numbers on computers makes a difference. For instance when using bitwise operations (collective boolean operations on bits) or bit field packing (storing several binary numbers in the same data). Or when data alignment matters (i.e. addresses multiple of some power of $2$)...

0

I used a lot of HEX values when creating emulators too. There's a really good video of someone creating a N64 emulator using C++, and using HEX values makes it sooo much easier when playing with memory addresses.

Javidx9 on YouTube does it, and I followed along with him a bit when making my own smaller CHIP8 emulator. It's real great stuff, and even doable in Python (to an extent, but it's easier in C++). https://www.youtube.com/watch?v=F8kx56OZQhg

Minko_Minkov
  • 340
  • 1
  • 7