Pointers in C programming language

The pointer in C language is a variable that holds the memory address of another variable.

The pointer in c language can be declared using * (asterisk symbol). We can declare a pointer as given below :
data_type *variable_name;

Example :
int *p;  //pointer to int

Advantages of using Pointers in C language :

  • Pointers allow passing of arrays and strings to functions more efficiently.
  • Pointers make it possible to return more than one value from the function.
  • Pointers reduce the length and complexity of a program.
  • Pointers increase the processing speed.
  • Pointers save the memory.

Example :
#include <stdio.h>
void main()
      int x=2;
      printf("\n Address of x = %d",&x);
      printf("\n Value at address x = %d",x);

Output :
Address of x = 1290765788
Value at address x = 2