// Understanding the array pointer and pointer array should begin with the definition, and the understanding of the Priority
// For an array of pointers, such as int * P [4. Because the array is defined first
// For an array pointer, such as int (* P) [4], the pointer is defined first.
# Include <iostream> # include <sys/time. h> using namespace STD; int main () {int arr [4] [4] = {1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; int * P [4]; // pointer array. [] the priority is higher *. P is an array containing four pointers to integer data, INT (* q) [4]; // array pointer, () with a high priority, indicating that Q is a pointer, this Pointer Points to the first address of an array of four elements for (INT I = 0; I <4; I ++) {for (Int J = 0; j <4; j ++) printf ("% 4D", arr [I] [J]); printf ("\ n ");} printf ("\ n"); q = arr; For (INT I = 0; I <4; I ++) {for (Int J = 0; j <4; j ++) {printf ("% 4D", * (q + I) + J); // is equivalent to a second-level pointer for an array pointer? } Printf ("\ n");} printf ("\ n"); For (INT I = 0; I <4; I ++) P [I] = arr [I]; // array of pointers, so that each element in the array corresponds to the address at the beginning of each row of the For (INT I = 0; I <4; I ++) {for (Int J = 0; j <4; j ++) printf ("% 4D", * (p [I] + j )); printf ("\ n");} printf ("\ n ");}