Reverse 2d array vertically?
<p>Okay, I got the filling of the 2D array pretty well... now I need to keep the same values that are randomly generated into the 2D array, but reverse the order of the vertical (the 2nd for loop). So basically the 2nd for loop needs to keep the same values, but in reverse order.
But I feel like if I go into the nested for loops and rand(), it will generate all new random letters...</p>

<p>Does anyone know how to go about doing this??
This is what I have so far:</p>

<pre><code>char array[20][20];

srand(time(NULL));

for(int i=0;i&lt;20;i++)
 {
     for(int j=0;j&lt;20;j++) {
         array[i][j]= ((rand() % 2) == 0) ? 'O' : 'X';
         cout &lt;&lt; array[i][j];
     }
     cout &lt;&lt; endl;

     for(int j=20-1; i&gt;=0; i-- {
         array[i][j]= ((rand() % 2) == 0) ? 'O' : 'X';
         cout &lt;&lt; array[j][i];
     }
     cout &lt;&lt; endl;
 }
</code></pre>

<p>EDIT
For anyone who is curious on how to fix this, I figured it out!!
Here is the code:</p>

<pre><code>char array[20][20];

srand(time(NULL));

for(int i=0;i&lt;20;i++) {
     for(int j=0;j&lt;20;j++) {
         array[i][j]= ((rand() % 2) == 0) ? 'O' : 'X';
         cout &lt;&lt; array[i][j];
     }
     cout &lt;&lt; endl;
}

cout &lt;&lt; endl;

for(int i=0;i&lt;20;i++) {
    for(int j=19;j&gt;=0;j--) {
        cout &lt;&lt; array[i][j];
    }
    cout &lt;&lt; endl;
}
</code></pre>
