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.
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.
My thought is if the pointers I'm given are Element* start and Element* finish...
number of elements = (finish - start) / sizeof(Element)
Is this logical thinking?