title: sprintf and unsigned int array in C
body: <p>I have a pointer to an array of ints and the length of the array as such:</p>
  
  <pre><code>unsigned int length = 3;
  int *array;        // Assume the array has 3 initialized elements
  </code></pre>
  
  <p>I also have a string and a buffer (assume it is sufficiently large) to put into sprintf as such:</p>
  
  <pre><code>char buffer[128];
  const char *pattern = "(%d, %d, %d)\n";
  </code></pre>
  
  <p>Assume that <code>pattern</code> will only have "%d"s and other characters in it, but could be any form (i.e. "Test %d: %d" or "%d %d"), and that the length of <code>array</code> will always be the same as the number of "%d"s.</p>
  
  <p>Since the length of the array can be anything, is there any way that I can do <code>sprintf (buffer, pattern, &amp;array[0], &amp;array[1], &amp;array[2])</code> without explicitly enumerating the elements of <code>array</code>? Something along the lines of <code>sprintf (buffer, pattern, array)</code>. I can write as many helper functions as are necessary. I was thinking of faking a va_list, but this seems to be bad practice as it restricts the program to a certain compiler.</p>