A pointer is a variable that holds a memory address. A pointer can have any name that is legal for other variable, and it is declared in the same fashion like other variables but it is always declared by * operator.
A Pointer in C language is a variable which holds the address of another variable of same data type.
Pointers are used to access memory and manipulate the address.Pointers are one of the most distinct and exciting features of C language.
It provides power and flexibility to the language.
Although pointers may appear a little confusing and complicated in the beginning, but trust me, once you understand the concept, you will be able to do so much more with C language.
Features of pointers
Pointers save the memory space.
Execution time with pointer is faster because data is manipulated with the address, i.e. direct access to memory location.
The memory is accessed efficiently with the pointers. The pointer assigns the memory space and also it releases. The memory is dynamically allocated.
Pointers are used with data structures. They are useful for representing two-dimensional and multi-dimensional arrays.
We can access elements of any type of array irrespective of its subscript range.
Pointers are used in file handling.
Pointers are used to allocate memory dynamically.
Example:
#include <stdio.h>
int main()
{
//Variable declaration
int num = 10;
//Pointer declaration
int *p;
//Assigning address of num to the pointer p
p = #
printf("Address of variable num is: %p", p);
return 0;
}