I have a few questions about multidimensional arrays. I understand how to allocate memory for them, but I do not understand why this is necessary (in addition to making things more readable).
The statement []for the array is overloaded, right? So why can’t you allocate one block of memory and gain access 1dArray[i*nInRow][offset],?
Is there any further increase in performance through the use of an array in several dimensions? Also, when the memory is dynamically allocated for the 2d array, are they stored in contiguous places or scattered across the heap? When data is requested, can I assume that everything is pulled out of memory as a block?
Most of the information I saw just explained the syntax. Any answers or suggested readings would be great.
source
share