Download

General c++ pointer question

I understand what a pointer is and stack and heap.

I understand that when you program and create new objects, it is on the heap as it returns a pointer. Now i wonder, does everything you create (object) in c++ is on the heap? I logically thought anything that may be creates during gameplay like a spawned object is created on the heap but it seems like even the player character and other stuff you program is on the heap. What is actually stack allocated? If I am wrong somehow, please let me know

TIA

Stack is for local variable within the function. The rest is heap…

1 Like