I'm sure this is probably a duplicate question but I'm having difficulty passing a 2D array from one class into a function in a different class- it seems like its only expecting one argument rather than four. I'm kind of new to C++ so I might be missing something obvious. Here's basically what the code looks like:
//global variables
int NN;
class x
{
...
void w(const int arr[][cow], int pig, int cow, int NN) //my problem is in here, the compiler will come up with errors like there is an expected ) before the first [] in my array and that cow isn't a variable in the scope even though from what i can tell i shouldn't have to declare it if i'm passing it in
{
... //nothing in the actual block of code has been setting off errors so i don't think its anything in here
}
};
class y
{
...
void e() //this function by itself compiles
{
int arr[NN][NN + 1];
int pig = 0;
int cow = 0;
x* temp = NULL;
...
//the function call
temp->w(arr, pig, cow, NN);
...
}
};
If i need to post more code i can but i really think its just in how i passed it; thanks in advance for any help