Explaining Pointers

Ok.
C++ dont care about where out variables get store in the system, It simply let our operating system decides, so before the program is started it cannot know that. but there are some ways that after compiling we can access the position of our data and set them manually.
For that we have to do some things.
We use & to get the position of the variable in the system.

FString student = 'Cena'; // we fill the student criable with name of Cena
FString* pointer; // we assign a poinnter variable (We set it to FString because we know that this pointer is going to be used for getting FString data)
*pointer = &student; // we get the position of student variable inside the system, its a long number usually and put our pointer there
*pointer = 'Devlogerio' // we change the value of student variable to Devlogerio but this time we did it manually by going to that address with our pointer and change whatever was after that position to Devlogerio, so in this case we changed Cena to Devlogerio.

I hope i could explain it :slight_smile:

Privacy & Terms