In practice it is rare to see more than a pointer to a pointer. Take the following code: I hope this (somewhat) brief overview helps with some of the different types of pointers you will see.
If you found this useful, check out some of my other posts on function pointers in C and pointers and arrays in c.
There are two main operators for working with pointers.
The operator is used when declaring a pointer and when dereferencing a pointer.
A pointer holds a reference to a variable; the reference being the memory address stored in the pointer.
When we access the value at that reference, we de-reference the pointer.For a compiler, a variable is a symbol for a starting memory address.The compiler knows two things about any variable, the name and the type. Back when C was created, computers were much slower. Programmers needed to be much more efficient at solving problmes.For , tells the compiler how much memory to store starting at that address. The more detailed answer has to do with call semantics. When you call a function in C, the value of any parameters are literally copied into the function’s call stack. Pass a char and 1-byte is copied into the function.A C compiler converts C source code to assembly source code. What happens when you need to pass a 100k element int array into a function?You can get a value, like we do in line 6 above, or you can set a value, like we do in line 10 above. When we declare a int pointer we are declaring the variable as a pointer, that it holds the address of another variable, and that the value at that address is an int.Same goes for a float pointer, char pointer, or any other type.Dereferencing can be used to either indirectly get a value from the pointer address or to assign a value to the pointer address. In this example we have used dereferencing to both get and set values.Some people get confused and think dereference means getting a value. Dereference means to indirectly access the address stored in the pointer.Declaring a pointer to be a specific type tells the compiler when the pointer is dereferenced the value pointed to will be of that type.You will notice in the example above we declare a pointer type and then assign the address of a value of the same type.