My understanding on pointer

A variable (normal variable, instance) works commonly creating a value’s copy to wich it makes a reference, with this I mean, if we have a building constructed on unreal and let’s say this building occupy 1GB of memory, when we use a variable we make a copy of the object (MyBigBuilding BuildingCopy;) with this in mind we now have 2GB of memory in two objects, but when we use a pointer it only stores were is placed our big building, with that in mind we only have 1GB of memory occupied by MyBigBuilding plus 64bits occupied by the pointer (64bits for 64bit machine and 32bit for 32bit machines).
Hope to be on the right path.

Hey bochom. I think you’re right from my understanding. I just wanted to expand on what you were saying. So when you make a reference to the myBigbuilding type you can pass the variable in to another function as a pointer instead of a copy of the variable. This is nice, because you can control the scope of your variables still. So you don’t need variables that are public across the entire program, you can just pass them in to other functions as pointers.

1 Like

Privacy & Terms