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

270 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 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.

You are viewing 1 out of 2 answers, click here to view all answers.