Why cant dynamically allocated variables can’t be named?

I understand why you cant define them but why cant you name them.

Or is it that you must always define them in order to name them?

Why do I have to always use a pointer?

Or is it that dynamically allocated variables on allocate space for a type to be stored and not really the variable itself so you must use a pointer?
Last edited on
Dynamically allocated variables don't exist until you create them with new.

You have to use a pointer because the address of the variable is not known until it is allocated on the heap.
oh ok
closed account (zb0S216C)
In addition to what AbstractionAnon said, a symbol of automatic storage is added to the translation unit's symbol table which is only accessible during compilation. During run-time, the symbol table will no longer accept new symbol entries; therefore, run-time memory allocation cannot have a symbol.

Symbol tables aside, I guess allocated memory does have a symbol: the symbol of the pointer which points to the allocated memory.

Last edited on
Topic archived. No new replies allowed.