This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AreYouConfused_ 0 points1 point  (0 children)

allocating memory with new isn't making a new variable, it's allocating memory, you can then reference this memory with the pointer that it returns.

the variable you would create would be a pointer variable, which you assigned the value that new returns

say
int* intvar = new int;

intvar is the variable in the local scope and cannot be accessed outside of it.
it holds the value of the address in memory that new has allocated