Your are passing the array, not its address.
arr
is an int[][] array
(in fact it is pretty the same as &(arr[0])
, which is a pointer to (the address of) the first line of your array. In C, there is no practical difference between an array and the corresponding pointer, except you take it’s address with the & operator.)
Edit: Ok, just to make me clear:
#include <stdio.h>
int fn(char p1 [][100], char (*p2)[100])
{
if (sizeof(p1)!=sizeof(p2))
printf("I'm failed. %i <> %i\n",sizeof(p1),sizeof(p2));
else
printf("Feeling lucky. %i == %i\n",sizeof(p1),sizeof(p2));
}
int main()
{
char arr[5][100];
char (*p)[100]=&(arr[0]);
fn(arr, arr);
fn(p, p);
return 0;
}
6
solved Passing array to a function in C