且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C++ 数组[索引] 与索引[数组]

更新时间:2022-06-27 01:05:47

编译器会转

index[array]

进入

*(index + array)

使用正常语法它会变成

array[index]

进入

*(array + index)

因此您会看到两个表达式的计算结果相同.这对 C 和 C++ 都适用.

and thus you see that both expressions evaluate to the same value. This holds for both C and C++.