Is there a difference between int *(a[10]) and int *a[10]?
I guess they are the same but, want to get confirmed, as the bracket is confusing me.
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.
No, there isn’t a difference between those two. The reason that they’re the same is because
[]has higher precedence than*, so the brackets are essentially redundant. They’re both a declaration for an array of 10intpointers.There is however a difference between the following:
int *a[10];int (*b)[10];In this case,
ais an array of 10intpointers, andbis a pointer to an array of 10ints.