Hello,
I am trying to find out how Dynamic Arrays are actually stored in memory. Really, I want to know how Vectors are stored in memory, but I deduce they are stored the same way.
If you have a dynamic array initialized at size 50, and it then needs to increase to size 75, what happens?
Does element 49 contain some sort of pointer to the next 25 elements, or are a new 75 consecutive spots in memory allocated, and then the first 50 elements are copied into this new block of 75 elements?
I have already done much research, and thus far what I find tells me how to initialize and use dynamic arrays within a program, but does not explain what is actually going on in memory.
Thanks so much
I am trying to find out how Dynamic Arrays are actually stored in memory. Really, I want to know how Vectors are stored in memory, but I deduce they are stored the same way.
If you have a dynamic array initialized at size 50, and it then needs to increase to size 75, what happens?
Does element 49 contain some sort of pointer to the next 25 elements, or are a new 75 consecutive spots in memory allocated, and then the first 50 elements are copied into this new block of 75 elements?
I have already done much research, and thus far what I find tells me how to initialize and use dynamic arrays within a program, but does not explain what is actually going on in memory.
Thanks so much
Comment