For my Engineering Class I have to write a program that will take in an nth degree polynomial. The degree will always be positive and an integer. Then I have to use Simpson's Rule and the Rectangular rule to compare the numerical integration results, well... on to the point. I am having trouble with the entering of the polynomial. I don't know if I should have the subfunction be type void or not, because I am going to have most of my calculations done in subfunctions. Also I am unsure whether or not to have the user input the polynomial coefficients as a string or a character array. Any help or advice would be appreciated.

Code:

#include <stdio.h>
#include <stdlib.h>
void polynomial(char *);
main()
{
}
void polynomial(char *ptr)
{
int degree;
printf("\nEnter the degree of the polynomial you wish to integrate.");
scanf("%d", °ree);
ptr=(char *)malloc((degree+1) * sizeof(char));
if(ptr= NULL)
{
puts("Memory Allocation Failed.");
}
}

When I have
Code:

ptr=(char *)malloc((degree+1) * sizeof(char));

the degree+1 is for the entire length of the polynomial, for instance if you had a 2nd degree polynomial you would have 3 terms, x^2 + x + #.