我有以下的數組:方法簽名,傳遞指針的靜態陣列上
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