Pointers to Pointers in c

when the pointer points to other point and to other,this forms a pointer chain system. first pointers container address of second pointer .second pointer contains the address of third pointer and goes on. When one pointer points to another pointer it is called a double pointer.

Insertion sort

Syntax:

int **x;
no of pointers in sequence = no of asterisks(*)
#include
int main () {
int var;
int *ptr1;
int **ptr2;
var = 400;
/* take the address of var */
ptr1 = &var;
/* take the address of ptr using address of operator & */
ptr2 = &ptr1;
/* take the value using pptr */
printf("Value of var = %d\n", var );
printf("Value available at *ptr = %d\n", *ptr1 );
printf("Value available at **pptr = %d\n", **ptr2);
printf("address var = %d\n", &var );
printf("address of ptr1 = %d\n", &ptr1 );
printf("address of ptr2 = %d\n", &ptr2 );
printf("value of ptr1 = %d\n", ptr1 );
printf("value of ptr2 = %d\n", ptr2 );
return 0;
}

output:

Value available at *ptr = 400
Value available at **pptr = 400
address var = 607716216
address of ptr1 = 607716208
address of ptr2 = 607716200
value of ptr1 = 607716216
value of ptr2 = 607716208

here,from the above program .ptr1 holds the address of var. and ptr2 hold the address of ptr1 and ptr2 cannot hold the address of var. in the output statement if we put pointers they will return the value of variable .so 12,13,14 lines gives same out put.15th line and 18th lines gives the same output because address of var and value stored in ptr1 is same.