Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does this address (0x00000400) = 1024

Im working in C++ and I have a #define VAL 0x00000400. when I set a variable equal to the define: int value = VAL; when I run through the debugger is shows the variable value = 1024. could someone explain how that turns into 1024? Maybe some links to memory address info, #define info, or something relevant.

like image 490
TheFuzz Avatar asked Sep 07 '10 22:09

TheFuzz


3 Answers

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

like image 112
GWW Avatar answered Oct 17 '22 03:10

GWW


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

By the way, you can use google to do base conversions. Search for "0x400 in decimal" and google will give you the answer.

like image 8
John Dibling Avatar answered Oct 17 '22 04:10

John Dibling


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

like image 3
Robert Avatar answered Oct 17 '22 04:10

Robert