title: Calculate number of elements in an array based on pointers to the first and last elements
body: <p>Suppose there exists an array, A, such that its elements are of struct Element and I am told that the struct Element is packed with no padding.  </p>
  
  <p>If I am given pointers to the first and last element in A, can I determine the number of elements in A based on the address of the pointers and amount of memory an Element takes up?  Or does the structure of an array in memory not work like that.</p>
  
  <p>My thought is if the pointers I'm given are Element* start and Element* finish...</p>
  
  <pre><code>number of elements = (finish - start) / sizeof(Element)
  </code></pre>
  
  <p>Is this logical thinking?</p>