Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m Sorry this Question is so long. ALL I NEED IS THE LAST FUNCTION!!! THATS IT

ID: 3561130 • Letter: I

Question

I'm Sorry this Question is so long. ALL I NEED IS THE LAST FUNCTION!!! THATS IT. PLEASE HELP ME!!!! THE LAST FUNCTION HAS TO DO WITH FREEING THE MEMORY.

Then I'm supposed to implement them in this Source File

Thanks!

Also, Heres the code I have for the first three functions. thanks for anyones help!

Your job is to complete and test poly.c to implement the functions declared in poly.h. Save copies of both of these files and testpoly. c in your working directory for this project, and rename the program skeleton before editing it: Do not change poly.h or testpoly.c - you will not turn in these files. Study and understand the data types declared near the top of poly.h, and know how these types can be used to form a linked list like the ones in chapter 7 of the text. Also look at the five functions that are already implemented in poly.c: Implement the seven required functions as follows:

Explanation / Answer

Implementation of last function: void freePoly(Poly*)

/*freePoly deletes the complete polynomial and frees up the space
*taken by all the terms in the polynomial.
*It take pointer to pointer to first term in the polynomial
*/

void freePoly(Poly *p)
{
  
       Term *t = *p;
       Term *next = NULL;
       while(t!=NULL)
       {
              /*before freeing the term store the pointer to next term
               *because we cannot find next term once the term is deleted
               */

               next = t->next;
               freeTerm(t);
               t = next;
       }
      
       /*polynomial is empty now*/
       *p = NULL:
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote