In the current chapter of Pointers in C, the introduction to address is given initially and then about the pointers and pointer variables.Any compiler need to store the variables in a memory.The memory address given to a particular variable is called as a
Pointer.
Computer's memory consists of 8 bit bytes in a continuous sequence. Portions of this memory are reserved when a program starts to store a program code, variables, functions, arguments, local variables and so on. The storage for each variable must reside in memory, and where it resides is defined by an address.
Every variable has an address even if it is not used which is just the offset from the base address to the location where the variable storage resides. Now, C provides a special category of variables specifically for handling these addresses. So these are
address variables and they are called
Pointers
.
Pointers in C or pointer variables also has a
type that indicates the variable type being pointed to provide a degree of safety as the compiler can check that the variable being pointed to, according to the rules governing that particular type. Sometimes type of a pointer might not be considered. There are many reasons to do this, but it should be done with some caution.In that situations, C provides a special type called
void
which means some storage whose type is unknown to the compiler.
Simply, pointer is
memory locator of a variable. Pointers play a key role in exempting C-language from other programming languages like java,visual basic,etc.
Note:
Whenever declaring a pointer specify the location where it has to be pointed.Pointer cannot point wherever it likes.