I am having problems with bubble sorting a 2d array. I know I need 3 loops but I do not know where to put the third. any help would be greatly appreciated.
Code:void bubble(int arr[])
{
int i, j;
for (i = 0; i < SIZE - 1; i++)
{
for (j = SIZE - 1; j > i; j--)
if (arr[j - 1] > arr[j])
swap(&arr[j - 1], &arr[j]);
printf("\nAfter pass %d: ", i);
printArr(arr);
}
}
void swap(int *pNum1, int *pNum2)
{
int temp; // NOT int *
temp = *pNum1;
*pNum1 = *pNum2;
*pNum2 = temp;
}