title: array alignment/sizeof() returning extra values
body: <p>The following bit of code...</p>
  
  <pre><code>void foo(char* x)
  {
          int i;
          int len = sizeof(x)/sizeof(x[0]);
  
          printf("len: %d\n", len);
          for(i=0; i&lt;len; i++){
                  printf("i: %d, v: %x\n", i, x[i]);
          }
  }
  </code></pre>
  
  <p>...when called as:</p>
  
  <pre><code>        char bar[] = {0xDE, 0xAD, 0xBE, 0xEF};
          foo(bar);
  </code></pre>
  
  <p>...outputs:</p>
  
  <pre><code>len: 8
  i: 0, v: ffffffde
  i: 1, v: ffffffad
  i: 2, v: ffffffbe
  i: 3, v: ffffffef
  i: 4, v: ffffffff
  i: 5, v: 7f
  i: 6, v: 0
  i: 7, v: 0
  </code></pre>
  
  <p>Not exactly sure if it's applicable to this but reading through similar posts on SO, it seems to be an alignment issue (I'm on a 64 bit machine).</p>
  
  <p>Any pointers?</p>
  
  <p>Thanks.</p>