In a C++ program, there is exactly
* one heap
* one stack — locals (ie auto variables) and static locals.
* one global space — globalVar is defined outside all functions.
An object (float, int, user-defined…) lives in one of the 3
In terms of cleanup, heap objects need delete (never automatically deallocated); global var lives forever; auto var has automatic cleanup. static locals live forever. [[ absolute c++]]
You can reasonably seat your ptr at
* static locals
* autos in main()
* heap objects