Hi, so I'm trying to only sort the pointer array in this code, but it's changing the values of the array its pointing at and I don't know why. Here is the parts of the code I find relevant:
The swap and sort function:
'''
void bubbleSort(int* listSort[])
{
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < SIZE - 1; j++)
{
if ((*listSort[j]) > (*listSort[j + 1]))
{
//int temp = list[j];
//int* ptr = &listSort[0];
//int* xptr = ptr + j; // temp
//int* yptr = ptr + j + 1;
swapIntPtr(&listSort[j], &listSort[j+1]);
}
}
}
}
//Call the swapIntPrt function from Bubble sort for swapping the
void swapIntPtr(int** xptr, int** yptr)
{
//int* zptr = *xptr;
//*xptr = *yptr;
//*yptr = zptr;
int z = **xptr;
**xptr = **yptr;
**yptr = z;
}
'''