Why the following guess is wrong ? (a software engineering company manager told me that it's almost correct but I don't understand why and I can't search for the answer in the Internet..)
int* ptr = new int; // Sorry I mistyped before
My claim :
- left part (ptr) is of static memory allocation.
- right part (new int) is of dynamic memory allocation.
// new edited : 1 Jan 2015 17:39 (UTC +08:00)
what I am thinking is,
It moves the pointer of stack down(or up?) to free a space for ptr
.
And find a empty space for a new int
.
And then store the address of this new int
to ptr
.
No comments:
Post a Comment