I'm writing a programm to create a roster. Every month has a different number of shifts, which is determined by a function. At the beginning of the programm the user enters the month, the according number of shifts gets calculated in a function and then I want to create a 2-dimensional array with that size. But aparrently I can't initialize an array like this. Can anyone help me out?
As you may have noticed, I'm a very inexperienced beginner, so I apologise for not expressing myself perfectly in advance.
//function to calculate number of shifts
const int getShift(const int month, const int year) {
...
return x;
}
int main(){
int array[getShift(8,2019)[2];
}
I got an error along the lines of "expression did not evaluate to a constant" although that number actually is a constant, or at least I want it to be one...
Thanks in advance for your help!