Passing arrays to functions

How can i pass a two dimesional array
(not a global variable) to a function from main().The array is an object to a class.
ab2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nietodCommented:
void function(char [10][20] TwoDArray)
{
}

int main()
{
   char Array[10][20];

   function(Array);
};

Let me know if you have any questions.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Louis020400Commented:
void MultiArrayparam1( int m[ 3 ][ 5 ]  )
{
//dimentions know at compile time
}

void MultiArrayparam2( int m[ ][ 5 ], int dim1 )
{
//pass first dime as an argument
}


void MultiArrayparam3( int * m, int dim1, int dim2 )
{
//pass both as arguments
}

void main()
{
    MultiArrayparam1( myArray );
    MultiArrayparam2( myArray,3);
    MultiArrayparam3( &myArray[0]      [0],3,5 );

}
0
AdihCommented:
//func receives an object by reference
void func(darray& darr);

void main()
{
//creating the object- 5,10 are
//parameters for the c`tor.
    darray d(5,10);
//sending the object to the function
    func(d);
}

0
nietodCommented:
So ab2, are you out there?
0
nietodCommented:
ab2, what is happening with this question?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.