Quote
Things I should add to my polynomial program:
I should have put this in the other post but its late, and i've been working on java homework - De-allocate my linked lists at the end of the program:
- From the main: poly1, poly2, sum, prod…
[li]From other functions free up individual links at the end of the function: current, preS, preC, slot…
- From the main: poly1, poly2, sum, prod…
you really don't want to free the individual links...
*gets out a soapbox, steps up and begins a speach*
since you dont copy the contents of the struct around, freeing up your current, preS, preC, etc... at the end of those functions will "inadvertently" free up the node in your linked list, then if you go and try to free up your list, you'll get heap overflow... returning more memory than you were allocated.
The best option for your other functions is to set the current, preS, preC, etc... pointers null as the last thing you do in the function.
*takes a bow, picks up the soapbox and puts it away*
:ph34r: