C++ memory
Assume I know a hexadecimal memory location of an integer. By knowing that address, how can I get to the number? (The hexadecimal memory location that I know is NOT stored in a variable etc.. I just want to type it in code and get the number).
8/15/2021 9:13:27 AM
Yahel
1 Answer
New AnswerAfter testing... int value = 42; long address = (long)&value; int casted = *(int*)address; By converting the address to the pointer of the type and dereference it, you can get the value back. But honestly, I don't know if such use of addresses is valid. It looks like an abuse to me.