I'm currently learning function that work with multi-dimensional array in C.
Let's say I have
short myArray[10][30].
I have declared following function prototype to work with myArray
.
void first(int n, short ar[][30]);
void second(int n, short ar[30]);
void third(int n, short (*ar)[30]);
My understanding is that the ar
parameter in both first
and third
function are equivalent. short ar[][30]
in first
function is equivalent to the short (*ar)[30]
in third
function because they are both pointer to array of 30 short
.
The ar
in second
function is different because in short ar[30]
, ar
is a pointer to short
, not a pointer to array of 30 short
.
Is my understanding correct?