Get rid of typedef and it will become a little clearer:
void P (const int A [][10])
{
}
int main(void)
{
int A[10][10];
P(A);
return 0;
}
The problem is that the array in the function parameter "decays" into a type pointer const int(*) [10], which is a pointer to the array where the elements are const.
, main, int(*)[10].
"pointer-to-type" "- ". , int*, const int*, . .
"pointer-to-array" "const-pointer-to-array", "--const-", , .
, C: const . - :
P( (const int(*)[10]) A);
, .
: C11 , , , :
#define const_array_cast(arr, n) _Generic(arr, int(*)[n] : (const int(*)[n])arr )
void P (const int A [][10])
{
}
int main(void)
{
int A[10][10];
P(const_array_cast(A,10));
return 0;
}