assuming you know about arrays (if not, draw back and punt, go study arrays!) then a pointer is the array index to a giant array that we call memory.
int index = 3;
x[index] = 42; //index IS a pointer, CONCEPTUALLY.
You are saying to go to some memory location offset from where X started, and do things there.
now lets do that in pointer speak:
int *index = new int; //ask the operating system for an unused memory offset.
so, out in memory, (which was the X array before) you now have an index/offset that you can use.
*index=42; //this says to modify the location at memory[index] to the value 42.
its the same thing, only the memory "array" is not tangible, and you need special keywords (new, delete in c++, malloc/free in C) and syntax (* and &address of and such) to use it.
why do you need them?
first, the memory here is off the stack, so you can now use MORE bytes of memory than you had before. Stack is small, and large programs can easily fill it up, but ram and virtual memory are huge, and you can do much more.
second, some data structures make use of it, like trees and linked lists (you can build these into arrays, too, but the concept is necessary to build the entity).
third, you may need to serialize data (often, this means taking address of, a pointer, casted as a bytes (unsigned char or whatnot).
all that to say C++ hides a lot of pointer needs behind the STL (vector, list, etc). The hands on usage is way down with those tools (though inside them, they use pointers, of course).
C lacks some of these ideas and you need them to create the structures that c++ has natively.
This is way oversimplified, of course, but its the simple version you asked for.
google a picture/animation of a linked list, to see what I meant.
Let me explain pointers a different way so you have a different viewpoint as well.
A pointer is a variable that stores a memory address. Think of it as any other variable:
1 2 3 4
int a = 12; //int is a variable type that holds an integer value
int* p = &a; //int* is a variable type that holds the memory address of an integer
//In this case, p is holding the memory address of the integer "a"
Pointers have plenty of uses and are necessary - because every variable has a memory address where its value is stored. And yes, the pointer has its own memory address too, where it stores the memory address it points to!
Lets look at an array:
1 2 3 4 5
int a; //array with 3 elements
a = 1; //Set the first element to 1
//The line above is the same as this:
*a = 1;
Why?? Because "a" is actually a pointer! By using the dereferencing operator "*", we access the memory "a" is holding, and then we set it to 1. By default, an array's variable is pointing to the first element of the array!
So by dereferencing "a", its the same as accessing the first element as usual through a.
@zaphse: The "a" is not a pointer. It is an array. However, array decays to pointer implicitly. That pointer has memory address of the first element of the array.
In sizeof a the "a" does not decay and you do get the size of the array.
C++ separates the issue of allocating an array from the issue of using an array. Once you have an array, what you actually have is a pointer to the first thing in the array
Since one knows the size of the whole array and the other doesn't, it proves that "a" would not just be a pointer, but I don't see the harm in thinking of it as such, especially just to get the concept.
Consider teaching just "arrays can be treated as pointers" instead of "arrays are pointers" to avoid simplifying in a way that is likely to cause confusion.
The simplification causes problems whenever the programmer needs to know details like
Given the declaration int x;
1. What is the type of &x?
2. What is the size of x?
3. What is the value category of the expression x?
4. What is the type of the expression x?
5. What is the value category of the expression x?
What most likely happened is that the disappearing posters were spammers. The usual MO is to copy and paste a question from some other site (or even from an older thread here), and/or an answer to someone else's question, so that you look like a genuine poster. Then, a day or so later, go back and edit the spam URL into the post.
Then, the spam post gets reported, and if the spammer still has a low post-count, the forum software deletes it.
For what it's worth, the original request was just "to explain the concept of pointers" or something like that.
On the topic of spam links. I don't think computer programmers are really even the target demographic.
I mean, nobody with a clue is going to click on spam links, so posting them into a forum full of technologists is just... dumb.