The code, for those who don't want to go off-site:

Code:

#include <stdio.h>
#include <stdlib.h>
//Declaration of ProtoTypes
int** ptrSort(int* arr, int size);
void mergeSort(int ** arr, int size);
void merge( int** sortArr1, int size1, int** sortArr2, int size2, int** outSortArr);
void copyArray(int ** arr, int ** tempArr, int size);
void printPointersArray(int ** pArr,int size);
void main()
{
int numbers[4]={7,2,5,9};
int size=4;
int **pArr;
pArr = ptrSort(numbers, size);
printPointersArray(pArr,size);
}
int** ptrSort(int* arr, int size)
{
int ** pArr;
int index;
pArr=(int**)malloc(sizeof(int*)*size);
if (pArr==NULL)
{
printf("Bad Memory Allocation");
exit(1);
}
for (index=0;index<size;index++)
{
pArr[index]=arr+index;
}
mergeSort(pArr,size);
return pArr;
}
// "Merge sort"
void mergeSort( int ** pArr, int size)
{
int** tempArr;
if (size == 1)
{
return;
}
else{
mergeSort(pArr, size/2);
mergeSort(pArr+(size/2), size-(size/2));
tempArr = (int**)malloc(sizeof(int*)*size);
if (tempArr==NULL)
{
printf("Bad Memory Allocation");
exit(1);
}
merge(pArr, size/2, pArr + size/2, size-(size/2), tempArr);
copyArray(pArr, tempArr, size);
free (tempArr);
}
}
// Merge two sorted array into a new array
void merge( int** sortArr1, int size1, int** sortArr2, int size2, int** outSortArr)
{
int readInd1, readInd2, writeInd;
readInd1 = readInd2 = writeInd = 0;
while(readInd1 < size1 && readInd2 < size2)
{
if(*sortArr1[readInd1] < *sortArr2[readInd2])
{
*outSortArr[writeInd] = *sortArr1[readInd1];
readInd1++;
writeInd++;
}
else {
*outSortArr[writeInd] = *sortArr2[readInd2];
readInd2++;
writeInd++;
}
}
}
void copyArray(int ** arr, int ** tempArr, int size)
{
int index;
tempArr=(int**)malloc(sizeof(int*)*size);
for(index=0;index<size;index++)
*tempArr[index] = *arr[index];
}
void printPointersArray(int ** pArr,int size)
{
int index;
if (size==0)
{
printf("There are not numbers to be printed");
return;
}
printf("The sorted array is : /n");
for (index=0;index<size;index++)
{
printf("%d ",*(pArr[index]));
}
}