In programming, what does the prefix 0x on a number like 0x1F indicate?
AnswerHexadecimal (base 16)
Languages such as C, Java, JavaScript and Python read a leading 0x as the start of a base-16 number.
Coding · Facts & stats
7 fact-checked facts about hexadecimal numbers and the 0x prefix, each with the reason behind it. 5 more are in today's round and join this page after it closes.
AnswerHexadecimal (base 16)
Languages such as C, Java, JavaScript and Python read a leading 0x as the start of a base-16 number.
Answer10
In hexadecimal, the first letter digit stands for the value that comes right after 9.
Answer4
Sixteen values need exactly four binary digits, since 2^4 = 16.
Answer0b
In both languages 0b starts a binary literal, 0o an octal one and 0x a hexadecimal one.
Answer2
A byte's values run from 0x00 up to 0xFF, so two hex digits always suffice.
Answer0x1000
4096 is 16 to the power 3, which hex writes as a 1 followed by three zeros.
Answer42
0x2A = 2 × 16 + 10 = 42.