Array of pointers in C Programming

Example: Write a program to assign the address of array elements to pointer variable and print the array element with address.

#include 
 int main ()
 {
  int  arr[] = {10, 20, 30};
  int i, *ptr[3];
 
   	for ( i = 0; i < 3; i++)
 	{
      		ptr[i] = &arr[i];      // assign the address array element to pointer variable
  	 }
   
  	 for ( i = 0; i < 3; i++) 
{
     		 printf("\n Value of arr[%d] = %d", i, *ptr[i] );
      		printf("\n Address of arr[%d] = %d", i, ptr[i] );
  	 }
    return 0;
}


OUTPUT


Value of arr[0] = 10
 Address of arr[0] = 1392582964
 Value of arr[1] = 20
 Address of arr[1] = 1392582968
 Value of arr[2] = 30
 Address of arr[2] = 1392582972