Why does this work:
void SomeFunction(int SomeArray[][30]);
but this doesn’t?
void SomeFunction(int SomeArray[30][]);
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.
Because, when passing an array as an argument the first
[]is optional, however the 2nd onwards parameters are mandatory. That is the convention of the language grammar.Moreover, you are not actually passing the array, but a pointer to the array of elements
[30]. For better explanation, look at following:Also remember that,
int[]is another form ofint*andint[][20]is another form ofint (*)[20]