Like this address (0x00000400) = 1024

Im working in C ++ and I have #define VAL 0x00000400 . when I set a variable equal to the definition: int value = VAL; when I run the debugger, the value of the variable = 1024 is displayed. Can someone explain how this turns into 1024? Perhaps some links to memory address information, #define info, or something important.

+4
source share
7 answers

0x00000400 is base 16 for 1024. Your debugger shows you the integer value in base 10.

+10
source

The "0x400" hexadecimal or base 16. 0x400, expressed as a decimal (base 10), is 1024.

By the way, you can use Google to create basic conversions. Search for "0x400 in decimal format," and Google will answer you.

+8
source

0x00000400 is 400 base 16, which is 1024 base 10.

+3
source

1024 in decimal = 400 in hexadecimal.

+3
source

0x400 is a hexadecimal number (indicated by the prefix 0x ). This is another way to represent the decimal number 1024 .

+3
source

In addition, the conversion from 0x400 (base 16) to base 10:

 4*16^2 + 0*16^1 + 0*16^0 4*16^2 + 0 + 0 4*256 1024 
+2
source

well, I have not seen your code yet, but 400h = 1024 decimal and you specify the integer compiler 'int value = VAL', it just does not display any notifications / warnings, it does this for you

0
source

All Articles