I have successfully stored hex values to memory using the method below and wanted to know if I can store decimal values as well.
Thanks.
Code:*(int*)(0xeff000040) = 405;
I have successfully stored hex values to memory using the method below and wanted to know if I can store decimal values as well.
Thanks.
Code:*(int*)(0xeff000040) = 405;
Any numeric literal in your program can be in any format you want it to be, because you're the only one who sees it -- the preprocessor converts it into a token for whatever-kind-of-number-it-gets-stored-as before the compiler even sees it.
(This post should not be read as condoning the above line of code in any way.)
There's no such thing as storing a "hex" or "decimal" value. The value is stored internally as binary. You can enter it (or print it) in any base you wish, usually hex, octal, or possibly binary. But the value is the same in every case. It's just a different way of writing it.
405 = 0625 = 0x195 = 0b110010101
A little inaccuracy saves tons of explanation. - H.H. Munro