Question: I am trying to write a simple C program that is supposed to call this printBooks function to print out a binary tree. It also
I am trying to write a simple C program that is supposed to call this printBooks function to print out a binary tree. It also is supposed to call a function printInOrder(), that puts each node in order. What i have included is my function printBooks which is supposed to print out each node/entry with pRoot being allocated already. The output only prints the heading and the very first node (I'm guessing because of the printf statement). What changes need to be made so that every node after the initial gets printed?

112 void printBooks(char *pszHeading, NodeT *pRoot) 113 114 115 116 117 printf(" %s ", ps2Heading); 118 119 120 printf(" %-9s %-40s %-8s %-10s %-8s %-9s " 121 122 if (pRootNULL) 123 124 125 126 127 if(pRoot !=NULL) 1281 129 130 131 132 133 134 135 136 137j 138 3 139 int i; NodeT *p; Book book; // output column headings , "Book Id", "Title", "Customer", "Ck Out Dt", "Late Fee", "Max Late; return; printf(" %-9s %-40s %-8s %-10s %8.21f %8.21f Nn" , pRoot->book.szBookId , pRoot->book.szTitle , pRoot->book.szCustomerId , pRoot->book.szCheckedOutDt , pRoot->book.dLateFeePerDay , pRoot->book.dMaxLateFee); printInOrder(pRoot)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
