0
What is dynamic memory
What is dynamic memory in c++
3 odpowiedzi
+ 1
As you know, automatic variables, also called scoped variables, are stored on the stack. These have a fixed size (static) and will be gone once the scope is terminated. On the other hand, there's the heap where you can create dynamic variables giving you more flexibility and control. Basically instead of giving the size fixed at compile time, the heap gives dynamic size at runtime. To use that dynamic memory, you need a pointer, otherwise there's no way of accessing that allocation. Don't forget to delete those allocations tho, otherwise you will get a memory leak, an error that occurs when the heap memory is overused and not deleting when done (deallocating).
0
Sidheshwar Tiwari ,
dynamic memory in c++ is explained in the `introduction to c++` tutorial.
> find more details in the module: `arrays and pointers`.
> lesson: `dynamic memory`.