Wednesday, February 20, 2008

Dynamic Memory in C++

Until now, in all our programs, we have simply had as much memory obtainable as we declared for our variables, having the size of all of them to be determined in the source code, before the implementation of the program. However, what if we need a variable amount of memory that can simply be determined during runtime? For instance, in the case that we necessitate some user input to determine the required amount of memory space. To solve such problem the answer is dynamic memory, for which C++ integrates the operators new and delete.

No comments: