Dereferencing a pointer to an array?
问题 Referring to the line with the comment: Why does adding parenthesis in the example work to print all the contents of the array? The example prints "one", then prints garbage. #include <iostream> int main() { const char* a[3] = { "one", "two", "three" }; const char*(*p)[3] = &a; for(int i = 0; i < 3; i++) { std::cout << *p[i] << std::endl; // this line } return 0; } It works after changing to this: std::cout << (*p)[i] << std::endl; 回答1: p is a pointer to an array of 3 elements like this: ┌───