Re: [algogeeks] Whats wrong?

2011-07-15 Thread sagar pareek
thanks ankit On Fri, Jul 15, 2011 at 1:07 AM, ankit sambyal ankitsamb...@gmail.comwrote: Change the printf statement to : printf(root-%x--root--%x--(root-data)=%x--(root-left)=%x--(root--right)=%x--*root--%d,root,root,(root-data),(root-left),(root-right),*root); Actually printf behaves

[algogeeks] Whats wrong?

2011-07-14 Thread sagar pareek
#includestdio.h #includestdlib.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;

Re: [algogeeks] Whats wrong?

2011-07-14 Thread Piyush Kapoor
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 sagarpar...@gmail.comwrote: #includestdio.h

Re: [algogeeks] Whats wrong?

2011-07-14 Thread ankit sambyal
Change the printf statement to : printf(root-%x--root--%x--(root-data)=%x--(root-left)=%x--(root--right)=%x--*root--%d,root,root,(root-data),(root-left),(root-right),*root); Actually printf behaves unexpectedly when we use %d before %x in the same printf statement. root and (root-data) will