I know it’s simple, but I can’t seem to make this work.
My function is like so:
int GefMain(int array[][5])
{
//do stuff
return 1;
}
In my main:
int GefMain(int array[][5]);
int main(void)
{
int array[1800][5];
GefMain(array);
return 0;
}
I referred to this helpful resource, but I am still getting the error "warning: passing argument 1 of GefMain from incompatible pointer type." What am I doing wrong?
EDIT:
The code is in two files, linked together by the compiler. I am not using gcc. The above code is exactly what I have, except the function is declared as “extern int” in the main. Thank you all for your time.
The code is fine. In a single file, this compiles fine for me with gcc.
My guess is that you’re
#includeing the wrong file — perhaps one that had a different declaration forGefMain. Or perhaps you just haven’t saved the file that declaredGefMain, so it still has an argument ofint [][3], for instance, which would cause the warning.I would suggest that you post the entire code to reproduce the problem (after you strip out everything that’s unneeded to reproduce it, of course). But chances are, at that point, you’ll have solved it yourself.