What I have to do is create a fxn called bubbleSort and a helper fxn called swap. bubbleSort takes two parameters, an array of doubles and a size, and puts the list in descending order. Swap takes two reference parameters. Here is what I have so far what seems to be wrong? I know they want the swap as a reference but I thought arrays coudnt be referenced...
Code:void swap(double array[], double array1[]) { double hold; double index; hold=array[index]; array[index]=array[index+1]; array[index+1]=hold; } void bubbleSort(double array[], int count) { for(int index = 0; index < count -1; index++) { if (array[index]<array[index+1]) swap(array[index],array[index+1]); } }



LinkBack URL
About LinkBacks


