title: Is there any way to pass an anonymous array as an argument in C++?
body: <p>I'd like to be able to declare an array as a function argument in C++, as shown in the example code below (which doesn't compile).  Is there any way to do this (other than declaring the array separately beforehand)?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  static void PrintArray(int arrayLen, const int * array)
  {
     for (int i=0; i&lt;arrayLen; i++) printf("%i -&gt; %i\n", i, array[i]);
  }
  
  int main(int, char **)
  {
     PrintArray(5, {5,6,7,8,9} );  // doesn't compile
     return 0;
  }
  </code></pre>