title: Why does i[arr] work as well as arr[i] in C with larger data types?
body: <p>It's fairly common knowledge that if you access an element of an array as <code>arr[i]</code> in C that you can also access the element as <code>i[arr]</code>, because these just boil down to <code>*(arr + i)</code> and addition is commutative. My question is why this works for data types larger than <code>char</code>, because <code>sizeof(char)</code> is 1, and to me this should advance the pointer by just one char.</p>
  
  <p>Perhaps this example makes it clearer:</p>
  
  <pre><code>#include &lt;string.h&gt;
  #include &lt;stdio.h&gt;
  
  struct large { char data[1024]; };
  
  int main( int argc, char * argv[] )
  {
      struct large arr[4];
      memset( arr, 0, sizeof( arr ) );
  
      printf( "%lu\n", sizeof( arr ) ); // prints 4096
  
      strcpy( arr[0].data, "should not be accessed (and is not)" );
      strcpy( arr[1].data, "Hello world!" );
  
      printf( "%s, %s, %s\n", arr[1].data, 1[arr].data, (*(arr+1)).data );
      // prints Hello world!, Hello world!, Hello world!
      // I expected `hold not be accessed (and is not)' for #3 at least
  
      return 0;
  
  }
  </code></pre>
  
  <p>So why does adding one to the array pointer advance it by <code>sizeof( struct large )</code>?</p>