Hey guys I'm encountering an error when trying to sort char * (C-strings). I'm not really sure what it is. Hoping someone can guide me.
1 2 3 4 5 6 7 8 9
void bubbleSort(char *arr, int n) {
for (int last = n-1; last > 0; last--) {
for (int i = 0; i < last; i++)
if (arr[i] > arr[i+1])
swap(arr[i], arr[i+1]);
}
}
Input : 'Z''M''A''L''Q''P''G''T''B''F'
Output : ' '' '' '' A M Z