Monday 17 June 2024

hex decimal start with 0x, && oxff, hex decimal numbering

 hexi decmial start with 0x

https://stackoverflow.com/questions/2670639/why-are-hexadecimal-numbers-prefixed-with-0x

hort story: The 0 tells the parser it's dealing with a constant (and not an identifier/reserved word). Something is still needed to specify the number base: the x is an arbitrary choice.


0h or 0x (H e X idecimal


& oxff

https://stackoverflow.com/questions/14713102/what-does-and-0xff-do

ff = 255 = 1111 1111 = 8 bits

& oxff means get last 8 bits:


   0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
 &  0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
    -------------------------------
    0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1

hex decimial numbering:

https://byjus.com/maths/hexadecimal-number-system/

Decimal Numbers4-bit Binary NumberHexadecimal Number
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F

No comments:

Post a Comment