I have a program that uses 2 2d arrays, grid1 and grid2. I have a 'bool which' that tells me which grid to use. I would like to be able to use 1 grid name throughout the program (as opposed to grid1 and grid2).. Here's what I tried, but it doesn't appear to be working. Any insight?
It compiles fine, but the assignment seems to never take place. I also tried cell **grid = grid1, but that doesn't work either. Any help?Code:enum cell {DEAD, ALIVE}; const int WIDTH = 100; const int HEIGHT = 100; cell grid1[WIDTH][HEIGHT]; cell grid2[WIDTH][HEIGHT]; int main { bool which = true; ... cell grid[WIDTH][HEIGHT]; if (which) { grid = grid1; } else { grid = grid2; } ... }
Thanks!
-Sean