What is the scope and lifetime of memory allocated dynamically with new in C++?
I am new to C++. Why can't we always use stack memory allocated in global scope? Why do we need to use dynamic memory allocations on heap?