Pointer to array

  1. int arr[10];  
  2. int *p[10]=&arr; // Variable p of type pointer is pointing to the address of an integer array arr.  

Pointer to a function

  1. void show (int);  
  2. void(*p)(int) = &display; // Pointer p is pointing to the address of a function  

Pointer to structure

  1. struct st {  
  2.     int i;  
  3.     float f;  
  4. }ref;  
  5. struct st *p = &ref;  

c pointers

Advantage of pointer

1) Pointer reduces the code and improves the performance, it is used to retrieving strings, trees, etc. and used with arrays, structures, and functions.

2) We can return multiple values from a function using the pointer.

3) It makes you able to access any memory location in the computer's memory.

  1. #include<stdio.h>  
  2. int main(){  
  3. int number=50;   
  4. printf("value of number is %d, address of number is %u",number,&number);    
  5. return 0;  
  6. }    

Output

value of number is 50, address of number is fff4