+ 2
How to pass a 2D array as a pointer ?
1 Resposta
+ 4
Function signature:
void p(short arr[][2]) { ... }
Invocation:
p(arr);
This is really a bit confusing. Arrays are actually pointers, and a multidimensional array variable stores pointers to another pointer. The [ ] notation is basically just syntactic sugar.
In the function header you must specify at least the size of the second array dimension, or you can even specify all of them, or use pointer syntax.
https://www.geeksforgeeks.org/pass-2d-array-parameter-c/
https://code.sololearn.com/cNm1E5gTNW8J/?ref=app