Objective: I'm working with pointers and I'm running into quite a few problems. Last week assignment was to write an insertion sort function to sort a ragged array in descending order. This week my professor wants me to change out all the indices and use only pointers.
void insert(int **table, int row)
{
    //  Local Declaration
    int **ptr = table;
    int **walkPlus, *walk, temp;
    //  Statement
    for(ptr = (table + 1); *ptr != NULL; ptr++)
    {
        temp = **ptr;
        walk = *(ptr - 1);
        while(*walk >= diff && temp > *walk)
        {
            walkPlus = ptr;
            **walkPlus = *walk;
            *walk--;
        }
        **walkPlus = temp;
        printf("\n");
    }
    return;
}
I feel that *walk--; is the cause to my problem. When I use printf statement to check it's value, but I'm getting a weird address. I know pointers are really important and I want to make sure that I understand the concept, so any help would be appreciated. Thank you.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#ifdef _MSC_VER
#include <crtdbg.h>  // needed to check for memory leaks (Windows only!)
#endif
#define MEM_ERROR printf("Not enough memory\n")
int** getRow(int *row);
void valiRow(int *row);
void getSize(int **table, int row);
void  valiSize(int *size);
void fillTable(int **table, int row);
void bubble(int **table, int row);
void insert(int **table, int row);
void freeAlo(int **table);
int main (void)
{
//  Local Declaration
int **table;
int row, i;
char answer;
int **pTable;
FILE* fpOutPut;
//  Statement
fpOutPut = fopen("Output.txt", "w");
if(fpOutPut == NULL)
{
    printf("Error, writing failed.\n");
    exit(103);
}
do
{
    table = getRow(&row);
    getSize(table, row);
    fillTable(table, row);
    bubble(table, row);
    insert(table, row);
    freeAlo(table);
    printf("\nDo you want to create a new ragged table? ");
    printf("[y] to continue: ");
    scanf(" %c", &answer);
    printf("\n");
}
while(toupper(answer) == 'Y');
fclose(fpOutPut);
#ifdef _MSC_VER
printf( _CrtDumpMemoryLeaks() ? "Memory Leak\n" : "No Memory Leak\n");
#endif
return 0;
}// main
/* getRow */
int** getRow(int *row)
{
//  Local Declaration
int **table;
//  Statement
printf("Please enter the number of rows (1-10): ");
scanf("%d", &*row);
valiRow(&*row);
table =(int**)calloc(*row + 1, sizeof(int));
if(table == NULL)
    MEM_ERROR, exit(100);
return table;
}
/* valiRow */
void valiRow(int *row)
{
//  Statement
while(*row > 10 || *row < 1)
{
    while(getchar() != '\n')
    ;
    printf("Please enter a number between (1-10): ");
    scanf("%d", &*row);
}
return;
}
/* getSize */
void getSize(int **table, int row)
{
//  Local Declaration
int size;
int **ptr = table;
int **pLast = table + row;
//  Statement
ptr = table;
for( ; ptr < pLast; ptr++)
{
    printf("Please enter a size (1-15): ");
    scanf("%d", &size);
    valiSize(&size);
    *ptr = (int*)calloc(size + 1, sizeof(int));
    **ptr = size;
}
if(table == NULL)
    MEM_ERROR, exit(101);
return;
}
/* valiSize */
void valiSize(int *size)
{
//  Statement
while(*size > 15 || *size < 1)
{
    while(getchar() != '\n')
    ;
    printf("Please enter a valid size (1-15): ");
    scanf("%d", &*size);
}
return;
}
/* fillTable */
void fillTable(int **table, int row)
{
//  Local Declaration
int random;
int **ptr = table;
int *pCurr, *pWalk;
//  Statement
srand(time(NULL));
for(pCurr = *ptr ; *ptr != NULL; ptr++)
{
    for(pWalk = (pCurr + 1); *pWalk < *pCurr; pWalk++)
    {
        random = -99 + rand() % 199;
        *pWalk = random;
    }
    pCurr = *(ptr + 1);
}
return;
}
/* bubble */
void bubble(int **table, int row)
{
//  Local Declaration
int **ptr;
int *pWalk;
int temp, target;
//  Statment
for(ptr = table; *ptr != NULL; ptr++)
{
    for(target = **ptr; target > 0; target--)
    {
        for(pWalk = *ptr + target; pWalk != *ptr + 1; pWalk--)
        {
            if(*pWalk > *(pWalk - 1))
            {
                temp = *pWalk;
                *pWalk = *(pWalk - 1);
                *(pWalk - 1) = temp;
            }
        }
    }
}
return;
}
/* insert */
void insert(int **table, int row)
{
//  Local Declaration
int **ptr = table;
int temp, *walk, **walkPlus;
//  Statement
for(ptr = (table + 1); *ptr != NULL; ptr++)
{
    temp = **ptr;
    walk = *(ptr - 1);
    while(*walk >= 0 && temp > *walk)
    {
        walkPlus = ptr;
        **walkPlus = *walk;
        *walk--;
    }
    **walkPlus = temp;
}
return;
}
/* freeAlo */
void freeAlo(int **table)
{
//  Local Declaration
int ** ptr;
//  Statement
for(ptr = table; *ptr != NULL; ptr++)
{
    free(*ptr);
}
free(ptr);
return;
}
 
     
     
    