Memory in C++ is divided into two categories, stack and heap. You know that an automatic variable is created when its definition is executed. The space for an automatic variable is allocated in a memory area called the stack. The stack has a fixed size that is determined by your compiler.
- [Instructor] When talking about memory in C++,…we'll talk about the stack and the heap.…Memory in C++ is divided into two categories,…the stack and the heap.…You know that an automatic variable is created…when its definition is executed.…The space for an automatic variable is allocated…in the memory area called the stack.…The stack has a fixed size that…is determined by your computer.…At the end of the block in which an automatic variable…is defined, the memory allocated for the variable…on the stack is released and is thus free to be reused.…
When you call a function, the arguments that you pass…to the function will be stored on the stack as well…along with the address of the location to return to…when the memory that is not used by the operating system…or other programs that are currently loaded…is called the heap or sometimes…referred to as the free store.…The heap represents unused memory of the program…and can be used to allocate the memory…dynamically when the program runs.…You can request this space to be allocated within…
- Addresses vs. pointers
- Understanding the relationship between pointers and arrays
- Dereferencing pointers
- Passing pointers as arguments
- Using new and delete operators