this is a simple piece of the code every thing is clear but i m having prob with p->link->link->link or p->link->link statements i m unable to understand how they are workingCode:#include<stdio.h> #include"alloc.h" struct node { int data; struct node *link; }; void main() { struct node *p,*q,*r; clrscr(); p=(struct node *)malloc(sizeof(struct node)); p->data=1; q=malloc(sizeof(struct node)); q->data=2; p->link=&q->data; r=malloc(sizeof(struct node)); r->data=3; q->link=&r->data; r->link=NULL; printf("p data=%d p address=%u",p->data,p->link); printf("\n%d",*p->link->link->link); printf("\n%d",*p->link->link); getch(); }
i know that *p->link->link will print the value at r and p->link->link->link will print 0 "NULL" ascii but can someone explain actually what is happening internally in these p->link->link....link statements what are these and how these are working THANX in advance.