What is a pointer to array, int (*ptr)[10], and how does it work?
问题 int (*ptr)[10]; I was expecting ptr to be an array of pointers of 10 integers. I'm not understanding how it is a pointer to an array of 10 integers. 回答1: ptr is of type "pointer to array of 10 int". In your declaration it is uninitialized so it doesn't point to any object. To make it point to an array: int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; // initialize in the declaration: int (*ptr) [10] = &arr; // or after: int (*ptr) [10]; ptr = &arr; 回答2: I like to read it like this: (great