Why does 2 dimension array passing to function requires its size?
问题 Inspired this quiestion . Why does - void display(int p[][SIZE]) // allowed and void display(int p[][]) // not allowed ? 回答1: Because arrays decay to pointers when passed to a function. If you do not provide the cardinality of the second dimension of the array, the compiler would not know how to dereference this pointer. Here is a longer explanation: when you write this p[index] the compiler performs some pointer arithmetic to find the address of the element that it needs to reference: it