Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does a memory address start with 0x? [duplicate]

Possible Duplicate:
Why are Hexadecimal Prefixed as 0x?

Memory addresses are often notated as a hexidecimal value prefixed with 0x. E.g:

> new.env()
<environment: 0x21d36e0>

Does the 0x part mean anything? Where does this notation come from? Is any other value possible instead of 0x?

like image 472
Jeroen Ooms Avatar asked Jul 13 '12 09:07

Jeroen Ooms


People also ask

What does 0x mean in assembly?

0x is hexadecimal (base 16). Without the 0x you get decimal (base 10).

Why are memory addresses in hexadecimal?

Computers convert binary data into the hexadecimal (hex) number system because it is much less complex than converting data into decimal numbers, and it is much easier for human beings to read hex numbers than to read binary numbers.

What is 0x In pointer?

The '0x' indicates that the number is in hexadecimal, if it was '0b' then it would in binary.

What is 0x in computer science?

The prefix 0x is used in code to indicate that the number is being written in hex.


1 Answers

The 0x is just a notation to let you know the number is in hexadecimal form.

Same as you'd write 042 for an octal number, or 42 for a decimal one.

So - 42 == 052 == 0x2A.

like image 93
Luchian Grigore Avatar answered Sep 18 '22 22:09

Luchian Grigore