What is the difference between the following declarations:
int* arr1[8];
int (*arr2)[8];
int *(arr3[8]);
What is the general rule for under
I guess the second declaration is confusing to many. Here's an easy way to understand it.
Lets have an array of integers, i.e. int B[8]
.
Let's also have a variable A which points to B. Now, value at A is B, i.e. (*A) == B
. Hence A points to an array of integers. In your question, arr is similar to A.
Similarly, in int* (*C) [8]
, C is a pointer to an array of pointers to integer.