A slight tangent, but something that surprised me: The [] operator literally is just syntactic sugar for pointer dereferencing and addition, so that the following equivalence holds:<p><pre><code> a[b] == *(a + b);
</code></pre>
The surprising consequence of this is that the following is legal:<p><pre><code> int foo[] = { 1, 2, 3 };
int bar = 2[foo]; /* yes, this evaluates to 3 */
</code></pre>
because<p><pre><code> *(2 + foo)
</code></pre>
is legal, and + is commutative. This works for both pointers and arrays. I haven't worked out a practical use, though I suspect the C++ metaprogramming crowd might have. Obviously the equivalence only holds on the native types in C++ as [], + and * can each be separately overloaded.