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 getNumbers(double **pptr);
double insertionSort(double **pptr, int counter);
double printTable(double *ptr, double **pptr, int counter);

int main (void)
{
       //Local Definitions
       double *ptr;
       double **pptr;
       int counter = 0;
       int i;

       //  Statements
       printf("\t\t Homework 3 - Pointer Applications:\n"
                  "\t\t    Insertion Sort and Pointers\n\n" );
       if(!(ptr = malloc(1000 * sizeof (double)))){
               printf("Not enough memory available.\n"); // no memory available
               exit(100);
       }
       counter = getNumbers(&ptr);// if input is too big

       ptr = realloc(ptr, counter * sizeof(double));
       if( pptr == NULL )
          MEM_ERROR;


       if(!(pptr = (double**) malloc(counter * sizeof ( double* )))){
               printf("Not enough memory available.\n"); // no memory available
               exit(100);
       }

       for(i = 0; i < counter; i++)
               pptr[i] = &(ptr[i]);

       insertionSort(pptr, counter);
       printTable(ptr, pptr, 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;
       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


   return num;
}


double getNumbers(double **pptr)
{
int counter = 0;
double number;


       printf("\nPlease enter numbers and enter -1 when you are done: ");
       number = getNum();
       while(number!= -1){
               (*pptr)[counter] = number;
               number = getNum();
               counter++;

       }

       return counter;
}
//This function sorts the array of pointer into ascending order.
double insertionSort(double **pptr, int counter)
{
int i, j;
double *temp;

       for(i = 1; i < counter; i++)
       {
               temp = pptr[i];
               j = i - 1;
                       while(j >= 0 && *temp < *pptr[j])
                       {
                               pptr[j + 1] = pptr[j];
                               j = j - 1;
                       }
               pptr[j + 1] = temp;
       }//insertion sort
return;
}
/*This function prints the array in ascending and descending order
as well as the original order that the user put in*/
double printTable(double *ptr, double **pptr, int counter)
{
int i;
       printf("\nAscending\tOriginal\tDescending\n");
       for(i = 0; i < counter; i++)
       {
               printf("%lg\t\t%lg\t\t%lg\n", *(pptr[i]), ptr[i], *(pptr[counter - 1 - i]));
       }

}
-Okay, so I know that I need to use free twice in main(for ptr and pptr). But I am not sure where to put it. Is there a specific place? At the very end of main, or after allocating the memory?
Thank you for your time.