4 ms·
This might not seem obvious. So allow me an attempt at expanding a bit. The difference is that a dangling raw pointer to the heap will point to anything that c
by bombela 1y ago
This might not seem obvious. So allow me an attempt at expanding a bit.
The difference is that a dangling raw pointer to the heap will point to anything that can be modified at any time.
But indexing a dynamic array guarantees that every elements is always well formed and safe to use.
- loeg 1y agoIt's true that the array approach cannot suffer from type confusion.