the expression "*root" causes the structure to be printed,which prints,(root->data=),10,(root->left=)0,(root->right)=0 and then the last value is &(root->data),other remaining values are ignored
On Fri, Jul 15, 2011 at 12:16 AM, sagar pareek <[email protected]>wrote: > #include<stdio.h> > #include<stdlib.h> > struct node > { > int data; > struct node *left; > struct node *right; > }*root=NULL; > main() > { > root=(struct node *)malloc(sizeof(struct node)); > root->data=10; > root->left=NULL; > root->right=NULL; > > printf("&root->%x--root-->%x--*root-->%d--&(root->data)=%x--&(root->left)=%x--&(root-->right)=%x",&root,root,*root,&(root->data),&(root->left),&(root->right)); > } > > In this,program,i try to print address of struct members but it print zero > for &(root->data) and &(root->left).it also print same value for root and > &(root->right).so anyone one can explain me in detail how struct members > stored in memory. > > -- > **Regards > SAGAR PAREEK > COMPUTER SCIENCE AND ENGINEERING > NIT ALLAHABAD > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- *Regards,* *Piyush Kapoor,* *CSE-IT-BHU* -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
