我有一个功能:
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)
我在调用函数中有以下代码:
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);
但我收到以下错误:
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
然后我将函数声明更改为:
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)
这样做,我得到:
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)’
有人可以告诉我如何解决这个问题吗?