These two options do not match. The second is a pointer to an int array .
You can use such an declaration as a parameter of a function when passing a 2D array as a parameter. For example, given this function:
void f(int (*ar)[5])
You can call it like this:
int a[5][5]; f(a);
Another example as a local parameter:
int a[5] = { 1,2,3,4,5 }; int (*ar)[]; // array size not required here since we point to a 1D array int i; ar = &a; for (i=0;i<5;i++) { printf("a[%d]=%d\n", i, (*ar)[i]); }
Output:
a[0]=1 a[1]=2 a[2]=3 a[3]=4 a[4]=5
dbush source share