What is difference between the following two function definitions?
A 2D array is being passed as parameter.
void fun(int a[][3])
{
//do some task
}
void fun(int (*a)[3])
{
//do some task
}
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.
Nothing,
[]is just syntactic sugar for a pointer.Here’s a simple test case to show that there’s not even a difference in indexing: