Stack — automatic, fast, limited. Heap — manual, slow, large.
1void func() {2 int x = 10; // Stack3 int* p = new int; // Heap4}
Stack:
Heap: