title: How to send and receive memory addresses via a socket in C?
body: <p>I want to send/receive a memory address via a socket in C.
  What I have is the following:</p>
  
  <pre><code>void *ptr = malloc(122); /* So the pointer points to some valid address */
  unsigned char *socketData = NULL;
  
  socketData = (unsigned char*)malloc(sizeof(void*));
  memset(socketData, 0, sizeof(void*));
  
  /* ??? How to get the memory address - where ptr points to - to socketData ??? */
  </code></pre>
  
  <p>I know that the way to print pointer addresses using <code>printf</code> is to use <code>%p</code>, i.e.</p>
  
  <pre><code>printf("%p", ptr);
  </code></pre>
  
  <p>But this prints for example 0x0021ef1a.
  What I want is just the following: 0021ef1a</p>
  
  <p>And on the receiver side: how to transform the received bytes back to a <code>void*</code>?</p>
  
  <p>Ah: and the code should work for 32bit as well for 64bit systems ;)
  Furthermore the code should compile using -Wall -Werror.... huh</p>
  
  <p>Thanks for helping!
  Have a nice weekend,
  jonas</p>