我有以下的数组:方法签名,传递指针的静态阵列上
char* mask[9];
int hSobelMask[9] = {
-1, -2, -1,
0, 0, 0,
1, 2, 1};
我想给这个阵列上的指针的方法是这样的:
int H = applyMask(&mask, &hSobelMask);
签名该applyMask功能是如下因素:
int applyMask(char** mask[9], int* sobelMask[9]);
,但我得到了下面的编译警告:
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]’
这个警告是什么意思,我该如何摆脱它?
与我们其他人不同的是,它的确是用于回答实际问题的指针顺序 –
+1。 (我认为这个问题被误导了,但实际上回答它仍然很好!) – ruakh
不错!我真的好奇这是如何可能的,个人而言,我会用typedefs做到这一点,所以我不必处理这种语法。虽然现在我想到了,但它开始有意义 – Shahbaz