I am trying to print the value pointed to by an address but the problem is I need to dereference this pointer based on the size that is passed to me. So something of this sort:
void print(Address addr, Int size) {
...
}
I am a little confused on how to achieve this. Can someone point me in the right direction?
EDIT: Ok so I'm thinking:
char p[80];
memset(p, '\0', 80);
memcpy(p, addr, size);
And then dereference as *p. If there is a better way or a correct way, please let me know