You are operating a pointer with an integer. Use the original addr
variable, which is an integer, instead of myaddr
:
UINT32 sec_addr = addr & 0xff; // according to your question, this should be 0xFF00
BTW: your first line:
INT32 * myaddr = (INT32*)addr; // This converted 'addr' to the hexadecimal format -- 'myaddr'
doesn't convert addr
into "hexadecimal format". Hexadecimal is just a way to represent the number when you print it. Both addr
and myaddr
can be showed into whatever numeric base you want.
printf ("%d %X\n", addr, addr);
prints the value of addr
in both decimal and hexadecimal format.