1. Note: This program will be graded based on whether the required functionality were implemented correctly instead of whether it produces the correct output, for the functionality part.
Modify insert.c (attached, Project 2, #1), the insert0 detection function using pointer arithmetic. The function prototype should be the following. Name your program insert2.c.
void insert0(int n, int *a1, int *a2);
The function should use pointer arithmetic not subscripting to visit array elements. In other words, eliminate the loop index variables and all use of the [] operator in the function.
2. A C program can represent a real polynomial p(x) of degree n as an array of the real coefficients a 0 a 1, , a n.
p(x) = a0 + a1x + a2x^2 , an x^n
Write a C program that inputs a polynomial of degree 8 and then evaluates the polynomial at various values of x. The output should have two decimal digits
Enter the eight coefficients: 1.2 3 2.4 4 1 9.1 3 0
Enter x: 4.4
Output: 37552.73
1) Name your program poly.c
2) As part of the solution, write and call the function get_poly() with the following prototype. The get_poly() function should fill the array of eight coefficients.
void get_poly(double *coeff);
The get_poly() function should use pointer arithmetic not subscripting to visit array elements. In other words, eliminate the loop index variables and all use of the [] operator in the function.
3) As part of the solution, write and call the function eval_poly() with the following prototype.
double eval_poly(double *coeff, double x);
4) You might need the pow function in math.h library to calculate the result of raising x to the power y. The function prototype of the pow function:
double pow(double x, double y);
5) Compile the program with lm:
gcc -lm -Wall poly.c