I am trying to create an 2D array. The number of columns is already defined, it will be a constant equal to 20. On the other side, I want the program will generate a number between 30 and 40, which will be the number of rows. I have already created the function to generate numbers between two values. The problem is that it won't allow me declare the array since one of the number of rows is not a constant value and the program can't figure out the space needed to reserve. How can I do it without using vectors or pointers?
const int COLUMNS = 20; /
int numOfRows = genNumInRange(30, 40), //Gets the random number from the function.
array[numOfRows][COLUMNS]; //
ERROR : Expression must have a constant value.
Any possible way I can do that?