C中的方法签名,将指针传递给静态数组

Ben*_*ier 2 c pointers method-signature

我有以下数组:

char* mask[9];
int hSobelMask[9] = {
    -1, -2, -1,
    0, 0, 0,
    1, 2, 1};
Run Code Online (Sandbox Code Playgroud)

我想在这个数组上给出一个像这样的方法的指针:

int H = applyMask(&mask, &hSobelMask);
Run Code Online (Sandbox Code Playgroud)

applyMask函数的签名如下:

int applyMask(char** mask[9], int* sobelMask[9]);
Run Code Online (Sandbox Code Playgroud)

但我得到以下编译警告:

demo.c: In function ‘customSobel’:
demo.c:232:7: warning: passing argument 1 of ‘applyMask’ from incompatible pointer type
demo.c:181:5: note: expected ‘char ***’ but argument is of type ‘char * (*)[9]’
demo.c:232:7: warning: passing argument 2 of ‘applyMask’ from incompatible pointer type
demo.c:181:5: note: expected ‘int **’ but argument is of type ‘int (*)[9]’
Run Code Online (Sandbox Code Playgroud)

这个警告意味着什么,我该如何摆脱它?

小智 5

您想将指针传递给这些数组吗?所以你可能正在寻找这个:

int applyMask(char* (*mask)[9], int (*sobelMask)[9]);
Run Code Online (Sandbox Code Playgroud)