title: Accessing arrays by index[array] in C and C++
body: <p>There is this little trick question that some interviewers like to ask for whatever reason:</p>
  <pre><code>int arr[] = {1, 2, 3};
  2[arr] = 5; // does this line compile?
  assert(arr[2] == 5); // does this assertion fail?
  </code></pre>
  <p>From what I can understand, <code>a[b]</code> gets converted to <code>*(a + b)</code> and since addition is commutative, it doesn't really matter their order, so <code>2[a]</code> is really <code>*(2 + a)</code> and that works fine.</p>
  <p>Is this guaranteed to work by C and/or C++'s specs?</p>