[Solved] Allocate memory 2d array in function C++


You have extra stars. The function should be

void assign_memory_for_board(int ROWS, int COLS, int *** board) {
   *board = new int*[ROWS];
   for (int i = 0; i < ROWS; i++) {
       (*board)[i] = new int[COLS];
   }
}

3

solved Allocate memory 2d array in function C++