
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
Global memory management in C++ : Stack or Heap?
Stack and heap are used to store variables during the execution of the program and it also get destroyed.
Global data structures or global variables are not consumed by stack or heap. They basically allocated in a fixed memory block, which remains unchanged.
int a[10]; // located in a fixed memory block int main() { int main() { float *ptr = (int *)malloc(sizeof(float)10.0)); //use heap. } }
- Related Articles
- Difference between Stack and Heap memory in Java
- Heap overflow and Stack overflow
- Difference Between Stack and Heap
- Memory Management
- Heap overflow and Stack overflow in C
- Proper stack and heap usage in C++?
- Memory representation of Binomial Heap in C++
- Memory Management in JavaScript
- Memory management in Java
- Memory Management in Python
- What is Memory Stack in Computer Architecture?
- Heap queue (or heapq) in Python
- Program to check heap is forming max heap or not in Python
- How to solve JavaScript heap out of memory on prime number?
- C++ Program for Best Fit algorithm in Memory Management

Advertisements