C ++ array [index]与index [array] [英] C++ array[index] vs index[array]
本文介绍了C ++ array [index]与index [array]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
In C arrays why is this true? a[5] == 5[a]
array [index]和index [array]都可能是编译器功能或语言功能.第二个怎么可能?
Is the possibility of both array[index] and index[array] a compiler feature or a language feature. How is the second one possible?
推荐答案
编译器将关闭
index[array]
进入
*(index + array)
使用常规语法,它将变成
With the normal syntax it would turn
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++.
这篇关于C ++ array [index]与index [array]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文