Tutorial by Examples

The stack is a small region of memory into which temporary values are placed during execution. Allocating data into the stack is very fast compared to heap allocation, as all the memory has already been assigned for this purpose. int main() { int a = 0; //Stored on the stack return a; } ...
The term 'heap' is a general computing term meaning an area of memory from which portions can be allocated and deallocated independently of the memory provided by the stack. In C++ the Standard refers to this area as the Free Store which is considered a more accurate term. Areas of memory allocate...
There are situations when we don't want to rely upon Free Store for allocating memory and we want to use custom memory allocations using new. For these situations we can use Placement New, where we can tell `new' operator to allocate memory from a pre-allocated memory location For example int a4b...

Page 1 of 1