call from main
matrix_multiplication(arrayA,arrayB,row1,col1,col2);
function definition
float matrix__multiplication(float **arrayA,float **arrayB,int row1,int col1,int col2)
{
float result[row1][col2];
result[][]=....
return result;
}
I wanted to know how to pass 2d arrays in function call,
how to receive in function definition
and how to return the result matrix?
Using raw pointers for your arrays like this is more C style than C++. Use vector of vector (indexing is still very efficient).
Better yet wrap the underlying storage in a Matrix class that implements the required matrix operations, holds and enforces dimensions, ensures matrices are compatible for the multiplication, and so on.
If your matrix demands are complex you could consider a library like Boost.UBlas versus roll your own. This is templated code and supports specializations for sparse, diagonal and other common types of matrix.