What does “internal pointer variable” actually mean and why is it called that?

264 views

So we’ve all seen the clip of an Indian teacher explaining that it “is called internal pointer variable”, but what does it actually mean and why?

In: 0

2 Answers

Anonymous 0 Comments

A pointer is a variable that stores the memory address within your RAM.

Whenever things are stored in a program, they are stored to RAM. RAM is indexed, so that each an every byte has its own address (which is just a number).
If you know something’s address, you can read (or write) what is stored there. So the pointer, just “points” you to the location of something stored within the RAM.

There are some useful properties, and helpful times to use it, but they are sometimes tough to understand at first.
Feel free to ask smaller details, or if something I said didn’t make any sense.

Anonymous 0 Comments

A pointer variable can be a variable that ‘points’ to another variable within the program itself. It doesn’t have to be pointing to the hard RAM address, just to a separate variable within the program.

You may want to do this if you have a procedure within the program that will use the value of a variable that you are not defining within that procedure. So when you call that procedure, you pass to it the ‘pointer’ to the variable in question, and the procedure can then work on that variable directly.

Imagine I have a variable called “Personal Name”. I build a procedure to check for input that is ‘junk’, or data that would not be found in English but is still valid as a string. I call that procedure “StringCleaning”.

I COULD build StringCleaning to accept any text in the procedure call (so I would call it with “StringCleaning(texttoclean)”) and it would return the text cleaned, but I may want to instead just pass a pointer to the variable to clean (“StringCleaning(NAME)”) and have it return a “Boolean” value for if it is clean or not. That way I can have it clean the text as well as report if it did anything, and it can clean things that I don’t know about.