-When I try to run it, the compiler tells me: "passing argument 1 of 'insertionSort' from incompatible pointer type". What is the problem? Also, I'm pretty sure that there are a bunch of other things wrong with this program, so if you see some other stuff, please feel free to point them out.Code:#include <stdio.h> #include <stdlib.h> //#include <crtdbg.h> // do not remove #define FLUSH while (getchar() != '\n') #define MEM_ERROR printf("Not enough memory!\n") // Prototype Declarations double getNum(void); double insertionSort(double *ptr, int counter); int main (void) { int *ptr; int **pptr; int counter; // Local Definitions // Statements printf("\t\t Homework 3 - Pointer Applications:\n" "\t\t Insertion Sort and Pointers\n\n" ); if(!(pptr = malloc(1000 * sizeof (*ptr)))){ printf("Not enough memory available.\n"); // no memory available exit(100); } if(!(ptr = malloc(1000 * sizeof ( double )))){ printf("Not enough memory available.\n"); // no memory available exit(100); } getNum(); insertionSort(&ptr, counter); // printf( _CrtDumpMemoryLeaks() ? "Memory Leak\n" : "No Memory Leak\n"); // do not remove printf("\n\t\tEnd of Program\n" "\n\t\tHave a great day!\n"); return 0; } /************************************************ Prompt the user to enter a valid integer number Pre: nothing Post: returns a valid integer */ double getNum(void) { double num; double number; double* p_walker; int counter; double *ptr; double **pptr; while (scanf("%lg", &num) != 1) { // scanf returns 1 if number read corrrectly FLUSH; // to "consume" the invalid input printf("-*- Invalid number. Please re-enter: "); } // while printf("\nPlease enter numbers and enter -1 when you are done: "); number = getNum(); p_walker = ptr; while(number!= -1){ *p_walker = number; pptr[counter] = p_walker; printf("entered1: %lg \n", number); printf("entered: %lg \n", *p_walker); number = getNum(); p_walker++; counter++; } printf("endpointer = %ld startPointer = %ld Counter = %d\n", p_walker, ptr, counter); ptr = realloc(ptr, counter * sizeof(double)); if( ptr == NULL ) MEM_ERROR; else ptr = ptr; int i; for (i = 0; i < counter; i++) { //printf("%lg\t",*(ptr+i)); printf("%lg\t", *(*pptr + i)); } return num; } double insertionSort(double *ptr, int counter) { int i, j; double temp; for(i = 1; i < counter; i++) { temp = ptr[i]; j = i - 1; while(temp < ptr[j] && j >= 0) { ptr[j + 1] = ptr[j]; j = j - 1; } ptr[j + 1] = temp; } printf("\n The ascending order of the list is: \n"); for (i = 0; i < counter; i++) { printf("\n%d", ptr[i]); } }
-Sorry if this program is a hot mess. Its a work in progress and not really even close to finishing. Thank you for your time!