数组的复杂声明
指针数组与数组的指针
声明数组的引用
数组中的元素访问
数组对象是一个左值
使用时通常会转换成相应的指针类型
x[y] -> *((x) + (y))
在 C++ 中左值的概念,通常是 locator value,const int x 也是一个左值。
int main()
{
int a[3] = {1, 2, 3};
const int x = 3;
std::cout << std::is_same_v<decltype((x)), const int&> << std::endl;
}
int a[3] = {1, 2, 3};
auto b = a;
std::cout << b[1] << std::endl; // *(b + 1)
std::cout << 1[a] << std::endl; // *(1 + a)