It was quite a long time ago
Printable View
I can see that people here have different opinions of what exactly a pointer is, even though at the same time I assume they are able to use them properly.
Maybe one could clear up confusion by learning some basic assembly language, where you learn how "pointers" truly work. I quoted pointer, because pointer can refer to the abstract idea (ie, reference variable) or to the physical operations that take place to implement that idea.
At the bit level, then, a 32-bit "integer" differs not at all from a 32-bit "pointer." It's just a finite series of bits. The difference is in how the CPU will interpret that "number." We, the programmers, tell the CPU how to do that by specifying different opcodes.
One opcode says "store the bits at some memory location at some other memory location" (x = y in C) and another says "go to this memory address and interpret the bits at that memory address as another memory address and copy those to some other memory location" (x = *y in C)
Now, you all may or may not have known that already, but I think it covers the basics of pointers. Now one just has to learn the C syntax behind it all.
A map is more like an array of pointers than just a pointer. You still need another pointer to use a map say like "1600 Pennsylvania Avenue NW in Washington, D.C.". That address isn't the pointer but this post now becomes a pointer to a place on the map that points to a place on the planet.
I prefer to think of it like the sign on the bathroom door. You wouldn't ........ on the sign would you? It's saying that a toilet is inside. Pointers are just really common knowledge. We follow road signs, elevator buttons, and just all sorts of things every day.
IMO your tutorial has just confused more people who already knew what a pointer was, but just didn't know how to use them in programming.
Just cause someone says something is hard doesn't mean it's hard. Pointer IMO are just to hyped up and that has caused more confusion than was nessacary.