hi, this is probably a simple question but how would i send a multidimensional array called myArray[][] into a function...i understand how to do it if the array is like myOtherArray[]

i'd rather not have to change myArray[][] into myOtherArray[] since the double subscripts [][] are easy for me to work with than the single one []

this is basically my attempt at doing this:

Code:

void Tools(int myArray[][]);

int main()
{
int theArray[12][2];

for(k=0; k<12; k++)
{
for(i=0; i<2; i++)
{
theArray[k][i] = i+k;
}
}

Tools(theArray);

return 0;
}

void Tools(int myArray[][])
{

...
//stuff happens
...

}

thanks for all your help :)

10-07-2005

Daved

You cannot pass a two dimensional array into a function like that. Specify the size of the second dimension (or use a 2-d vector).

10-07-2005

Salem

Copy/paste works.

If you have this
int theArray[12][2];

The function prototype/definition can be written as
void Tools(int theArray[12][2])

> void Tools(int **Array);
This is VERY wrong - they're arrays, not pointers - don't let the fact you can use [][] on both of them indicate any sort of equivalence.
If you wanted pointer notation, it would be
void Tools(int (*Array)[2] );