Possible Duplicate:
C: create a pointer to two-dimensional array
When an array is defined, as
int k[100];
it can be cast to int*:
int* pk = k;
It there a pointer variable a multidimensional array can be cast to?
int m[10][10];
??? pm = m;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is not a “cast” though. Cast is an explicit type conversion. In the above examples the conversion is implicit.
Not also that the pointer type remains dependent on all array dimensions except the very first one. It is not possible to have a completely “dimensionless” pointer type that would work in this context, i.e. an
int **pointer will not work with a built-in 2D array. Neither will anint ***pointer with a built-in 3D array.