Where are pointers allocated in memory?
Objects created by "new" and "malloc" are allocated in the "heap" while others are allocated in the "stack". But where is the pointers returned by such functions are allocated in the memory. Pointers are also a type of variable as far as I know, so they need to be placed somewhere in the memory like other variable, but where? Is it "stack"?
Another question that confuses me is that when you create a object using "new" in a function, the object is allocated some space in the "heap" area, but why all the books and online tutorials are saying all the local variables are allocated in the "stack" area? So what's really been allocated some space in the "stack" :confused: ?
Thanks in advance!