Pass 2d array to function in C?

Posted by Evelyn on Stack Overflow See other posts from Stack Overflow or by Evelyn
Published on 2010-06-02T16:17:13Z Indexed on 2010/06/02 16:34 UTC
Read the original article Hit count: 278

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?

© Stack Overflow or respective owner

Related posts about c

    Related posts about arrays