title: How to copy hex representation of uint_64 to unsigned char array in hex, in C?
body: <p>I'm not sure how to put what I am trying to achieve in words, but I'll just put an example below, hope you guys can lend me a hand! </p>
  
  <p>Basically I'm trying to copy the hex representation of uint64_t value into an unsigned char array, in hex. </p>
  
  <p>What I have:</p>
  
  <pre><code>uint64_t src;
  unsigned char destination[8];
  /* codes omitted, some codes that will change the value of src */
  printf("src: %"PRIx64"\n", src); //this prints out src: 3132333435363738
  </code></pre>
  
  <p>How do I copy the values from src into destination array in a way that:</p>
  
  <pre><code>destination[0] = 0x31;
  destination[1] = 0x32;
  destination[2] = 0x33;
  //and so on...
  </code></pre>
  
  <p>Thanks!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I'm sorry If my question is unclear, I'm very new to programming and I'm struggling to explain myself.
  Basically I'm just trying to store whatever that prints out from that printf() into the unsigned char array as hex.</p>
  
  <p>e.g, printf() outputs a string of "3132333435363738", I want to take 31 and store it in dst[0] where the value of dst[0] will be 0x31, and so on, where dst[1] will be 0x32.</p>
  
  <p>Please bear with me, thanks!</p>