Bubble Sort + enum
#2

You should use weak enum tags (weak tags start with lower case letter, strong with upper case)
Weak tags don't case warnings if the tag wasn't defined in the function

Also the sort function doesn't seem correct
pawn Код:
enum eListInfo
{
    l_int,
    l_str[10],
    Float:l_float
}
new List[][eListInfo] = {
    {2,"Test2",2.2},
    {1,"Test1",1.1},
    {4,"Test4",4.4},
    {3,"Test3",3.3},
    {5,"Test5",5.5}
};

BubbleSort(array[][], idx = 0, start = 0, len = sizeof(array)) { // code from wikipedia
    new
        i,
        l
    ;
    len--;

    do {
        for(l = 0, i = start; i < len; ++i) {
            if(array[i + 1][idx] < array[i][idx]) {
                ExchangeArraySlots(array, i + 1, (l = i)); // taken from md-sort by Slice
                // https://sampforum.blast.hk/showthread.php?tid=343172
            }
        }
    } while((len = l));
}
Reply


Messages In This Thread
Bubble Sort + enum - by ATomas - 14.03.2014, 13:45
AW: Bubble Sort + enum - by Nero_3D - 14.03.2014, 16:53
Re: Bubble Sort + enum - by ATomas - 14.03.2014, 19:36
AW: Bubble Sort + enum - by Nero_3D - 14.03.2014, 20:41
Re: Bubble Sort + enum - by ATomas - 14.03.2014, 21:56

Forum Jump:


Users browsing this thread: 1 Guest(s)