title: Storing values of an array in one variable
body: <p>I am trying to use md5 code to calculate checksums of file. Now the given function prints out the (previously calculated) checksum on screen, but I want to store it in a variable, to be able to compare it later on. </p>
  
  <p>I guess the main problem is that I want to store the content of an array in one variable.
  How can I manage that?
  Probably this is a very stupid question, but maybe somone can help.</p>
  
  <p>Below is the function to print out the value. I want to modify it to store the result in one variable.</p>
  
  <pre><code>static void MDPrint (MD5_CTX* mdContext)
  {
   int i;
   for (i = 0; i &lt; 16; i++)
   {
     printf ("%02x", mdContext-&gt;digest[i]);
   } // end of for 
  } // end of function
  </code></pre>
  
  <p>For reasons of completeness the used struct:</p>
  
  <pre><code> /* typedef a 32 bit type */
   typedef unsigned long int UINT4;
  
   /* Data structure for MD5 (Message Digest) computation */
   typedef struct {
    UINT4 i[2];                   /* number of _bits_ handled mod 2^64 */
    UINT4 buf[4];                                    /* scratch buffer */
    unsigned char in[64];                              /* input buffer */
    unsigned char digest[16];     /* actual digest after MD5Final call */
   } MD5_CTX;
  </code></pre>
  
  <p>and the used function to calculate the checksum:</p>
  
  <pre><code>static int MDFile (char* filename)
  {
   FILE *inFile = fopen (filename, "rb");
   MD5_CTX mdContext;
   int bytes;
   unsigned char data[1024];
  
   if (inFile == NULL) {
      printf ("%s can't be opened.\n", filename);
      return -1;
   } // end of if
   MD5Init (&amp;mdContext);
   while ((bytes = fread (data, 1, 1024, inFile)) != 0)
   MD5Update (&amp;mdContext, data, bytes);
   MD5Final (&amp;mdContext);
   MDPrint (&amp;mdContext);
   printf (" %s\n", filename);
   fclose (inFile);
   return 0;
  }
  </code></pre>