c - Why isn't it possible to pass a two-dimensional array as function argument? -


i searching pointers in c, , found this question. basically, user wants know how pass matrix argument of function in c. voted answer says can't use pointer pointer (type ** identifier) because:

(...) static 2d array requires second level of pointers const pointer static array

what mean when says "const pointer static array"? , how coded? know const variables (included pointers) mean, static variables too. but, in case, why have const pointer static array?

what mean when says "const pointer static array"?

i think meant array needs treated though it's contiguous; needs sequence of elements 1 after other no room pointers. might trying claim dereferencing two-dimensional array once (e.g. *mat or mat[0]) should result in constant points @ sub-array (which incorrect in situations, 1 of i'll cover soon, when used operand of sizeof).

fwiw, incorrect:

the previous header correct if matrix dynamic array.

int mat[size][size]; if inspect object, sizeof mat equal sizeof (int) * size * size; there's no room pointer storage within matrix. however, in void ins (int **matrix, int row, int column);, int **matrix tells matrix points @ int *, implies there is room pointers, , implies matrix might not be contiguous.

... how coded?

incorrectly, question, int ** points @ int * objects, not @ int[size] objects.

... why have const pointer static array?

see first paragraph of answer.


Comments