Let's say I have a function called MyFunction(int myArray[][])
that does some array manipulations.
If I write the parameter list like that, the compiler will complain that it needs to know the size of the array at compile time. Is there a way to rewrite the parameter list so that I can pass an array with any size to the function?
My array's size is defined by two static const int
s in a class, but the compiler won't accept something like MyFunction(int myArray[Board::ROWS][Board::COLS])
.
What if I could convert the array to a vector and then pass the vector to MyFunction
? Is there a one-line conversion that I can use or do I have to do the conversion manually?