c - Printing left and right values of an avl tree -
i trying write piece of code displays integers being loaded binary tree. have written far:
node*t; t = null; for( j = 0; j < 33; j++) { printf ("table %d \n", j+1); printf ("linenum left data right\n"); printf ("%5d %5d %5d %5d", t->num, t->left->data, t->data, t-> right -> data); t = insert(j, a[j], t ); } the program still keeps crashing though. how can solve that? going wrong way?
edit: fixed problem pointed out in previous comments
printf ("%5d %5d %5d %5d", t->num, t->left->data, t->data, t-> left ->right); ------------------------------------------------------------------------------------------------^
do mean t->right->data?
Comments
Post a Comment