Binary numbers and representation of bases

So binary is just base 2, right? 1s and 0s. But why, when you convert from dec to bin, for example to Google, does it have (x) b in front of the actual number? What does, for example, 0b __ mean?

+5
source share
1 answer

The designation 0b in front of the number is just an indicator that the following is represented in binary form. So, if you see something like 1001, you know that number is β€œone thousand one,” not nine, written in binary format.

In general, the prefix 0b usually means binary, the prefix 0 usually means octal, and the prefix 0x usually means hexadecimal.

Hope this helps!

+8
source

Source: https://habr.com/ru/post/1490372/


All Articles