Most of the questions here have already been answered in other questions.
Pointers are Indents . They can be called pointers. As they point to something, they are always an address of something. Although it can be used in other contexts, in general programming, these addresses are from memory and point to objects that are in this position. So we can say that the pointer is the position (coordinate) where your home is. latitude and longitude, street and number in such city.
A pointer is usually 4 or 8 bytes long, and in old or very limited current devices, it can have 2 or even 1 byte except exoteric architectures. I doubt that one day it will need more than 8 bytes that already allows to address more than all information produced in the world currently in a single device, that is, it can address 2 raised to 64 positions. No current architecture even supports it.
Then it is an integer , generally positive, that indicates the memory position of an object any.
It can be stored in a processor register, at some level of cache, RAM or even in another location, although if it is used in a different process or persisted, it is almost certain that something will not work at another execution time .
Just like any stored number, you can assign a name in the code to it, that is, it can stay in a variable. Technically a pointer points to a memory location; at the highest level this position may even be indicated in the code with a variable variable name .
Indentation is important to give you flexibility and allow for a series of tricks that make it easy to create structures and algorithms for a requirement . If you did not have the pointer everything you need would have to be used in a linear fashion, you would have to copy the data you need by duplicating them , would complicate the management of memory, access would be extremely slow (almost everything that has complexity O (1) today would have to be O (N), is a brutal difference), among other problems.
A array is feasible because of the pointer . The dynamic allocation only works because of it .
Think of the index of a book, it has pointers to the pages where that information is in the book. Or at a job you do and say on what page the book was got that. Imagine without this information how difficult it is to find what you want, you would have to search the whole book.
Pointer is an abstract concept that has some processor support to deal with. Programming languages have ways to implement access to pointers in a slightly easier way for a human. C-like languages improve a bit , but not much because you still have to tinker with the pointer.
Other languages prefer, or only allow, to use a reference, which in the background is a pointer more controlled.
The C # pointer is a middle ground between pointer and reference . It is insecure, but not as much as in C because it does not allow access to arbitrary memory address without control. out
, ref
and the new in
are references, that is, they are pointers to some object in memory, but it is not possible to manipulate the pointer any way you want, the compiler does all the work and control for you. Objects created with classes and delegates use references, but internally they are pointers.