Is there a Variable allocated on the Heap?

You seem to have understood. There is a float on the heap* and a pointer on the stack*. The disagreement is 'just' a naming convention for how you refer to the float.

Some people talk of things-that-are-pointed-to in terms of the-thing-that-does-the-pointing. I am inclined to agree with you: this is potential confusing, and can add complexity.

However in the interest of fairness: keep in mind different people have different motivations for the way they use language. If you never want to deal with pointers and they are just a way of having a variable persist outside of its scope then seeing (*a) as the variable and remembering it obeys slightly different rules is not completely without merit.

[*] Modulo grammar/standards nazisim.


a is a pointer with automatic storage duration.

It points to a double which has dynamic storage duration.

It's your job to call delete a; before you lose a pointer to the dynamic memory; typically when a drops out of scope.

(Informally speaking, and talking of typical implementations of C++, you can say that a is on the stack and it points to memory on the heap.)