dimanche 22 février 2015

Error: Cannot convert 'float*' to 'float' in assignment



void sortArray(float* array1[], int arrSize){

float tempStore = 0.0;

for (int distBetween = arrSize / 2; distBetween > 0; distBetween /= 2){

for (int i = distBetween; i < arrSize; i++){

for (int j = i - distBetween; j >= 0 && array1[j] > array1[j + distBetween]; j -= distBetween){

tempStore = array1[j]; //Error occurs here
array1[j] = array1[j + distBetween];
array1[j + distBetween] = tempStore; //And here
}
}
}
}


I'm trying to use a shell sort to sort an array of 5000 elements but I keep getting errors about converting between 'float*' and 'float'. I've tried making void sortArray(float array1[], int arrSize) the arguments but it breaks when I try calling it in main with an error saying "Cannot convert 'float*' to 'float' for argument 1". I've been googleing and changing code for about an hour and I still can't figure out what is causing the problem.




Aucun commentaire:

Enregistrer un commentaire