Printing the even squares from an array into a separate array
<p>From the main function:</p>

<pre><code>for (int i = 0; i &lt;= squaresLength; i++)
    {
        cout &lt;&lt; arraySquares[i] &lt;&lt; endl;
    }
    cout&lt;&lt;endl;
</code></pre>

<p>The function definition:</p>

<pre><code>   void evenSquares(int arrIn[], int lengthIn, int arrOut[], int&amp; lengthOut)
{
    int i, j;
    for (i=0; i&lt;lengthIn; i++)
    {
        if (((arrIn[i]*arrIn[i])%2)==0)
        {
            for (j=0; j&lt;lengthIn; j++)
            {
                {
                    arrOut[j]=(arrIn[i]*arrIn[i]);
                }
            }

        }
    lengthOut=j;
    }

}
</code></pre>

<p>Output</p>

<pre><code>25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
25600
0
</code></pre>

<p>This function is a mess I know. It is supposed to calculate the square of each element of arrIn, and then store the even squares in arrOut, while setting the new value of lengthOut as the number of even squares in arrOut. Thanks in advance for your help</p>
