Pointers are a central feature of the C Programming language. They server as a uniform way to generate references to elements within different data structures. Pointers are a source of confusion for novice programmers, but the underlying concepts are fairly simple.
1.Every pointer has an associated type.
2.Every pointer has a value.
3.Pointers are created with the & operator.
4.Pointers are dereferenced with the * operator.
5.Arrays and pointers are closely related.
6.Casting from one type of pointer to another changes is type but not its value.
If p is a pointer of type char * having value q, then the expression (int *)p + 7 computes q + 28, while (int *)(p + 7) computes q +7.
7.Pointers can also point to function.
The value of a function pointer is the address of the first instruction in the machine-code representation of the function.
Example:
int (*f)(int *);
Thus we see that f is a pointer, as indicated by"(*f)". It is a pointer to a function that has a single int * as an argument, as indicated by "(*f)(int *)".Finally, we see that it is a pointer to a function that takes an int * as an argument and returns int.
int *f(int *);
would be read as:
(int *) f(int *);
That is, it would be interpreted as a function prototype, declaring a function f that has an int * as its argument and returns an int *.