I have a function:
void ord_matrix_multiplication(Cache& cache, Block* block1[][], Block* block2[][], Block* block3[][], int A[][], int B[][], int C[][], int i, int j, int k, int n, int s)
i have following code in the calling function:
int A[n][n];
Block* blocks1[n][n];
int B[n][n];
Block* blocks2[n][n];
int C[n][n];
Block* blocks3[n][n];
...
//some code
...
ord_matrix_multiplication(cache, blocks1, blocks2, blocks3, A, B, C, i, j, k, n, s);
But i'm getting following error:
cacheaware.cpp:35: error: declaration of ‘block1’ as multidimensional array must have bounds for all dimensions except the first
cacheaware.cpp:35: error: expected ‘)’ before ‘,’ token
cacheaware.cpp:35: error: expected initializer before ‘*’ token
I then changed the function dclaration to:
void ord_matrix_multiplication(Cache& cache, Block* block1[][100], Block* block2[][100], Block* block3[][100], int A[][100], int B[][100], int C[][100], int i, int j, int k, int n, int s)
On doing so, i'm getting:
cannot convert ‘Block* (*)[(((unsigned int)(((int)n) + -0x00000000000000001)) + 1)]’ to ‘Block* (*)[100]’ for argument ‘2’ to ‘void ord_matrix_multiplication(Cache&, Block* (*)[100], Block* (*)[100], Block* (*)[100], int (*)[100], int (*)[100], int (*)[100], int, int, int, int, int)’
Could someone please tell me how i could fix this?
nis a constant, you're using variable length arrays which are not standard in C++. Why not usestd::vectorinstead? You can make a vector of vectors, and pass it around easier.