title: Copy hex values with sprintf in C
body: <p>From the code below I am trying to get the result of the result var into a string var but no success so far.
  What's wrong? Why I can't get the right result? If I print this directly it's ok...</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;openssl/md5.h&gt;
  
  char *string = "stelios";
  unsigned char s[MD5_DIGEST_LENGTH];
  int main()
  {
   int i;
   unsigned char result[MD5_DIGEST_LENGTH];
  
    MD5(string, strlen(string), result);
  
    // output
    for(i = 0; i &lt; MD5_DIGEST_LENGTH; i++){
     sprintf(s,"%0x", result[i]);//
     printf("%x",s[i]);
    }
     printf("\n%x",s);
  
     return EXIT_SUCCESS;
    }
  </code></pre>