title: Offset between two array element addresses in C
body: <p>I have a question asking me to find the offset in bytes between two array element addresses:</p>
  <blockquote>
  <pre><code>double myArray[5][7];
  </code></pre>
  <p>If C stored data in column-major order the offset (in bytes) of <code>&amp;myArray[3][2]</code> from <code>&amp;myArray[0][0]</code> would be:</p>
  </blockquote>
  <p>In column major order, I think elements would be laid out as such:</p>
  <pre><code>[0][0] -- [1][0] -- [2][0] -- [3][0] -- ..... -- [3][2]
  </code></pre>
  <p>So in my mind to get the offset in bytes is to count the number of jumps between [0][0] and [3][2] and times that by 8 since it's an array of doubles. However, what's confusing me is that it's asking for the offset using the &amp; operator. Would this somehow change the answer since it's asking between two addresses or is the process still the same? I think it'd be the same but I'm not 100% certain.</p>
  <p>If my thinking is correct would this then be 8*15 bytes?</p>