I am completely confused, pointers are just another name for some variable, I have read a couple of explanations and I'm still not getting why I would want to use them .
I love these questions because everyone has an answer.
You don't need to know about pointers you can let the magic happen.
int fred[10];
fred[0] = 123; // Works
i = fred[0]; /// works
i = fred[j]; // works
That all works fine. You can ignore any videos, ignore any books etc.
However one day you might be interested in passing a reference to one of the elements to a function rather than the whole array.... you could pass the whole array and an index or could pass a reference to the single element... e.g. &fred[2]
& gives you the address of the location of element fred[2]. Given an address you can get to the value by using *
So
int* interesting = &fred[2];
*interesting = 567;
is equivalent to fred[2] = 567
Now in C there are a few syntactic sugars in operation so... fred is actually short-hand for &fred[0] i.e. the address of the 0-th element of fred
Also at compile time the type of elements of an array is known so fred+3 takes into account the size of the fred elements. i.e fred+3 and &fred[3] are equivalent.
Likewise pointer arithmetic works so...
int* interesting = &fred[2];
interesting++;
*interesting = 321;
sets the value of &fred[3]
Once you know the & and * operators you can apply them to anything. So for example you can have a pointer to a function and then call it
(*fn)(args), which is useful for looking up functions at runtime... e.g. FSM implementations.
The underlying processor will be either using a pointer (the address) to a memory location or an internal register to hold a value. Machine operations for indirection using a register as an address are common place and efficient.
They are also dogs.... and a particularly cool, inbound aircraft warning system, one is described here...
https://en.wikipedia.org/wiki/Judy_(dog)