我已经阅读了标准的所有相关条款,但对于这种特殊情况,我无法正确解释它们:
const int arr[4][2] = {};
const int *ptr1 = (const int*)arr; // Is it OK/NOK and why?
const int *ptr2 = arr[0]; // Is this the same?
const int *ptr3 = &arr[0][0]; // Same?
Run Code Online (Sandbox Code Playgroud)
标准对这个演员有什么看法?
更新。
这是另一个相关的问题:
int i0 = ptr1[0];
int i2 = ptr2[2];
int i7 = ptr3[7];
Run Code Online (Sandbox Code Playgroud)
标准对直接从这些指针获取值有何看法?