问题
So, binary is just base 2, right? 1s and 0s. But why, when you convert from dec to bin, on Google for example, does it also have an (x)b in front of the actual number? What does the, for example, 0b __ mean?
回答1:
The notation 0b in front of a number is just an indicator that what follows is represented in binary. That way, if you see something like 1001, you know it's the number "one thousand one" rather than nine written out in binary.
More generally, the prefix 0b usually means "binary," the prefix 0 usually means "octal," and the prefix 0x usually means "hexadecimal."
Hope this helps!
来源:https://stackoverflow.com/questions/17535843/binary-numbers-and-representation-of-bases