|
>The first line doesn't crash the program. While, if don't comment out the second line, it crashes.
As expected. You can only declare an array of a certain size before it trashes your computer. The second line creates such an array while the first line doesn't create an array at all. It simply allocates a block of dynamic memory and points a pointer to it. If you don't mind me being inaccurate for the sake of simplicity, it goes like this:
Anything you create with new is on the heap, and the heap is virtually (haha! I made a funny) limitless.
Anything else is on the stack, and the stack is very limited by comparison.
__________________
Even if the voices aren't real, they have some pretty good ideas.
|