hi, I am making a program about bubble sort and my problem is the biggest number you entered becomes 0 in the process, can someone help me bout this,
this is my code:
void bubbleSort(int array[], int size ){
int numCompares = size - 1, ctr = 0;
int temp;
cout << "*** BUBBLE SORT PERFORMED ***\n" << endl;
while(numCompares != 0){
last = 1;
for(int i = 0; i <= numCompares; i++){
WHOA what did we just do? array[10] accesses the 11th member of the array, but there are only 10 elements that we meant to access. It means that we just swapped our largest value with some unknown value (in this case, 0).