Take the 2-minute tour ×  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  share|improve this question Can you
elaborate a little - do you mean that sometimes you want to
dereference the pointer as a 32-bit int (say if size==4) and
sometimes as a 64-bit int (if size==8)? Or are you after
something else? –  Michael Burr Oct 15 '10 at 4:49 @Michael:
That's right. I am trying to print the hex representation of
these numbers. –  Legend Oct 15 '10 at 4:55 add comment  3
Answers  up vote 3 down vote accepted  Your question is very
unclear. If you mean you want to dump arbitrary binary dat