c++ - How do I create a pointer to an array of object pointers -
i have two-dimensional array of pointers block objects
block* grid[grid_columns][grid_rows]; (int i=0; i>grid_columns; i++) { (int k=0; k>grid_rows; k++) { grid[i][k] = null; } }
how create pointer grid?
??? // create pointer grid here myblock.shiftdown(???); // pass pointer grid function
the function definition of myblock.shiftdown. should put in place of ??? make work?
void block::shiftdown(???) { if (row == grid_rows) ???grid[column][row] = this; else row++; }
edit: i'm trying here letting block::shiftdown manipulate grid. if there's easier way hear it.
what problem with:
void block::shiftdown(block* g[grid_columns][grid_rows]) { if (row == grid_rows) g[column][row] = this; else row++; }
and call it:
myblock.shiftdown(grid);