I would like to have an array int candidates[9][] where the first dimension is known (9) and the second, depends on the execution.
I found that a method to allocate the array was the following:
int *candidates[9]; /* first allocation at declaration */
for(int i=0;i<9;i++) candidates[i] = new int[6]; /* allocation at execution */
but when I use it like that, and I try to access to candidates[i][j], it doesn't work. I initialize candidate[i] with a function fun() that return and int[] of the right size, but the content of candidate[i][j] is wrong.
candidates[0] = fun();
I don't understand where I am wrong... Thank you for your help :-)
std::array<std::vector<int>, 9>.