| ??? 07/06/08 05:23 Read: times |
#156417 - Compile error using a bubble sort |
I believe this should work, but I'm not sure what parameters I'm supposed to pass considering the array is already initialized. I'm getting a compile error of :
IO.C(378): error C214: illegal pointer conversion which makes sense, but I'm not sure what I'm supposed to pass. I can't find much info on how to pass the data parameters to the sort routine. What am I missing?
void bubbleSort(int my_array[], int array_size); //prototype
uchar my_array[5] = {9,4,2,8,3}; //my array initialized out of order
void bubbleSort(int my_array[], int array_size) //sort it
{
int i, j, temp;
for (i = (array_size - 1); i >= 0; i--)
{
for (j = 1; j <= i; j++)
{
if (my_array[j-1] > my_array[j])
{
temp = my_array[j-1];
my_array[j-1] = my_array[j];
my_array[j] = temp;
}
}
}
}
void main (void)//main program
{
while(1)//Loop this section forever
{
bubbleSort(zoom_array[], 5); //sort forever test
}
}
|
| Topic | Author | Date |
| Compile error using a bubble sort | 01/01/70 00:00 | |
| Is the array 'uchar' or is it 'int'? Do not mix. | 01/01/70 00:00 | |
| argument consistency | 01/01/70 00:00 | |
| I had one error and type mismatch seen | 01/01/70 00:00 | |
| more careful with decrement unsigned char | 01/01/70 00:00 | |
| Use different identifiers for global and auto | 01/01/70 00:00 | |
| Yes I saw the corruption... | 01/01/70 00:00 | |
| You can use any type you like. | 01/01/70 00:00 | |
thanks guys.... | 01/01/70 00:00 |



