I have found in book that we can use a pointer to point to another pointer.So if we want a pointer p2 to point to another pointer p1 which points to an int then we should declare and use as **p2.Now these creates a chain of pointers.Although i had tried upto 4 steps of chaining,i want to know if this is reasonable and correct to do,or it causes any problem.I want to know a bit more about it because in book it is not elaborately explained.Any help and information about this topic is appreciated.I had done a simple program of chaining pointers.I also want to know if you people could be found in any chatroom or C programming Chatrooms.Please post a reply...
The code of the simple program was:
Code:
#include<stdio.h>
#include<conio.h>
int main()
{
int x,*p1,**p2,***p3,****p4;
x=100;
p1=&x;
p2=&p1;
p3=&p2;
p4=&p3;
printf("x=%d \t&x(address of x)=%u",x,&x);
printf("\np1(address of x)=%u\t*p1(value at %u)=%u",p1,p1,*p1);
printf("\np2(address of p1)=%u\t*p2(value at %u)=%u",p2,p2,*p2);
printf("\np3(address of p2)=%u\t*p3(value at %u)=%u",p3,p3,*p3);
printf("\np4(address of p3)=%u\t*p3(value at %u)=%u",p4,p4,*p4);
printf("\n****p4(****&p3)=%d",****p4);
getch();
return 0;
}