【发布时间】:2010-03-29 17:13:09
【问题描述】:
我有以下签名的功能:
void box_sort(int**, int, int)
和以下类型的变量:
int boxes[MAX_BOXES][MAX_DIMENSIONALITY+1]
当我调用函数时
box_sort(boxes, a, b)
GCC 给了我两个警告:
103.c:79: warning: passing argument 1 of ‘box_sort’ from incompatible pointer type (string where i am calling the function)
103.c:42: note: expected ‘int **’ but argument is of type ‘int (*)[11] (string where the function is defined)
问题是为什么? int x[][] 和 int** x(实际上是 int* x[])在 C 中是否不是同一类型?
【问题讨论】:
-
什么是
MAX_BOXES和MAX_DIMENSIONALITY?它们是宏、常量、...?