read in array into another array C++
<p>after reading inputs to an array:</p>

<pre><code>int * inputs;
</code></pre>

<p>the "<code>inputs</code>" is 1 dimensional array: <code>inputs[6]</code>, then reading this array out, the values are:</p>

<pre><code>inputs[0]=1
inputs[1]=2
inputs[2]=3
inputs[3]=4
inputs[4]=5
inputs[5]=6
</code></pre>

<p>I would like to read this array into another one dimensional array:</p>

<pre><code>int counter=0;
int * allElements = new int[6];

for(int i=0; i&lt;6; i++)
{
      allElements[counter++] = inputs[i];
}
</code></pre>

<p>That is a traditional way of reading all of the elements into one dimensional array and I believe if I read the elements of "<code>allElements</code>" this way:</p>

<pre><code>for(int i=0; i&lt;6; i++)
   printf("%d ", allElements[i]);
</code></pre>

<p>and it should be: <code>1 2 3 4 5 6</code></p>

<p>However, I would like to read all elements of that array into the 1 dimensional array such that when I do it like this:</p>

<pre><code>for(int i=0; i&lt;6; i++)
   printf("%d ", allElements[i]);
</code></pre>

<p>It should be: <code>1 3 5 2 4 6</code></p>

<p>How can I achieve this way?</p>
