I have a code that I passed a certain place in the memory. This place in the memory is pointing to an array
uint32_t *ps2 = NULL;
uint32_t src_address = 0x1ffffc3;
How can I read the value of the array from this address?
I tried to cast it as follows 
*ps2 = (void *)src_address;
but it gives me an error: invalid conversion from ‘void*’ to ‘uint32_t 
Regards,
You have two problems:
First of all, the pointer ps2 is a null pointer, it doesn't point anywhere. That means you can't dereference it.
src_address is not a pointer, when it really should be.
All in all there's seems to be some mixup in your understanding of pointers and how they are used.
For it to work, first define ps2 as not a pointer:
uint32_t ps2;
then define src_address as a pointer:
uint32_t *src_address = (uint32_t *) 0x1ffffc3;
and finally dereference src_address like a normal pointer:
ps2 = *src_address;
There is a possible third problem: The address of src_address is not aligned for an uint32_t. On some systems unaligned access is invalid and will lead to hardware exceptions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With