Often encounter these two concepts, it is easy to confuse, here carefully summed up.
pointer array : An array whose elements are pointers. the number of bytes that the array occupies is determined by the array itself.
array pointer : is a pointer that points to an array. the 32-bit system is always 4 bytes.
To illustrate:
1) int *p1[n];
2) int (*P2) [n];
1) The priority of "[]" is higher than "*". P1 is first combined with "[]" to form the definition of an array, with the array named P1,int * decorated with the contents of the array, that is, each element of the array. That is, p1 is a pointer array that contains n pointers to data of type int.
2) The priority of "()" is higher than "[]", "*" and P2 constitute a pointer definition, and the pointer variable named P2,int modifies the contents of the array, that is, each element of the array. The array does not have a name here and is an anonymous array. That is, p2 is an array pointer to an array that contains n data of type int.
To assign a two-dimensional array to a pointer, you should assign this value:
int a[3][4];
int (*p) [4]; The statement defines an array pointer to a one-dimensional array with 4 elements.
P=a; Assign the first address of the two-dimensional array to p, i.e. a[0] or &a[0][0]
p++; After the statement executes, that is, P=p+1;p crosses line a[0][] points to the line a[1][]
So an array pointer is also called a pointer to a one-dimensional array, also known as a row pointer.
On pointer array and array pointers