We have defined arrays as a collection of elements of the same type, organized in sequence so that we can reference them with an integer index.
Since a pointer variable points to another variable of the declared data type, you might expect the declaration to look like this: If pointers contain addresses, there should be a way to give them an address as a value.
All variables have an address, a designation of where they are stored in memory.
We know variables in C are abstractions of memory, holding a value.
That value is , defined by a data type definition in the variable declaration. A pointer is a variable whose value is an address, typed by its declaration. That fact might seem intuitive for other data types, but it's hard to remember for pointers.
We can derive the address of a variable by placing a "&" symbol in front of the variable name.
Here is an example: That value makes sense to the computer, but it is of no use to programmers.If addresses are just numbers, then we can do computations with them.Indeed, we can do pointer arithmetic in an intuitive fashion.This memory space does not even need a name associated with it.You create space in memory using the In this allocation, we have created a space that is big enough to store 5 integers.As with other variables, if we try to assign values from incompatible types, errors will result.We have said that a pointer contains an address into memory.To do this, we have to in the statement is a dereference.Using the same syntax to declare pointers and to dereference pointers can be a bit confusing, especially if the declaration is used with an initial value, like in the above example.As you might think, pointer arithmetic uses operators to increment or decrement addresses.However, to increment a pointer means to add enough to its value to move to the next element of the data type to which it points.