title: Static array initialization of individual elements in C++
body: <p>The following code works with GCC's C compiler, but not with the C++ compiler. Is there a "shortcut" to achieve the same result in C++?</p>
  
  <pre><code>int array[10] = {
      [1] = 1,
      [2] = 2,
      [9] = 9
  };
  </code></pre>
  
  <p>EDIT:
  Humm, I found this, clarifies everything.
  <a href="http://eli.thegreenplace.net/2011/02/15/array-initialization-with-enum-indices-in-c-but-not-c/" rel="nofollow">http://eli.thegreenplace.net/2011/02/15/array-initialization-with-enum-indices-in-c-but-not-c/</a></p>