Okay, so I have a few multidimensional arrays that I would like to pass to a function so the function can do things with them. Here's a simplification of what I'm trying to do.
#define WIDTH 10
#define HEIGHT 10
int testarray1[WIDTH][HEIGHT];
int testarray2[WIDTH][HEIGHT];
int indexCounter;
void instantiateTestArray (int[WIDTH][HEIGHT] inputArray) {
indexCounter = 0;
for (int index1 = 0; index1 < WIDTH; index1++) {
for (int index2 = 0; index2 < HEIGHT; index2++) {
inputArray[index1][index2] = indexCounter++;
}
}
}
int main (int argc, char **argv) {
instantiateTestArray(testArray1);
instantiateTestArray(testArray2);
}
(I am not actually trying to number all the cells in order, I'm just using a simple example so I don't muddy the problem)
So, it says I need a ')' before inputArray on the function declaration line, which doesn't make much sense to me, because how will I access the data that gets passed? I tried going back and redefining my arrays as a multidimensional array of pointers so I could pass a pointer to it instead but the arrays have a lot of dimensions and are very large and the system runs out of memory. And, apparently I had to specify the exact size of the array I passed to the function, because without specifying it didn't like it either. How do I do this?