Usable case of pointer to array with unspecified bounds in C++ (not in C)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Consider following code: int main() { int (*p)[]; // pointer to array with unspecified bounds int a[] = {1}; int b[] = {1,2}; p = &a; // works in C but not in C++ p = &b; // works in C but not in C++ return 0; } In pure C you can assign a pointer to this type of address of an array of any dimension. But in C++ you can't. I found one case when compiler allows assign value to such pointer: struct C { static int v[]; }; int main() { int (*p)[] = &C::v; // works in C++ if 'v' isn't defined (only declared) return 0; } But could not find any