Allocate memory 2d array in function C++
问题 I'm trying to dynamically allocate memory for a 2D array inside a function in C++. A question exactly like this has been asked except that it is written using malloc and dealloc, so I was wondering if you could help me convert it to use new and delete. Here is the other question: Allocate memory 2d array in function C I tried changing it to the following code, but I'm getting errors. void assign_memory_for_board(int ROWS, int COLS, int *** board) { *board = new int**[ROWS]; for (int i = 0; i