How do I add polynomials and print them? [List]

a
Last edited on
bump
Your code seems to be vastly over-complicated. Fundamentally, a polynomial is defined by the set of its coefficients - so use arrays!
e.g. a[0] + a[1]x + a[2]x^2 + ... + a[N]x^N
The polynomial is defined by the array a[], of size N+1.

To 'add' two polynomials you are simply adding corresponding array elements and forming a new array.

To 'output' the polynomial, loop through the elements of the array, outputting a[i]x^i for i = 0 up to the degree N of the polynomial.

I haven't a clue why you are using a pointer polyPtr (and have no idea where it is defined).


Not enough information.
You need to show your declarations for PolyType and TermNode.

Topic archived. No new replies allowed.