So I have a struct that I want to sort by each element, ascending and descending.
I'm creating 14 different sort function because I don't know how to pass struct element as a function argument.
I want to cut it to 2 sort function ascending & descending, so I don't have 14 functions.
How do I deal with this?? Thanks in advance!
struct propertySales{
    unsigned int tanggal[3];
    char pelanggan[30];
    char jenisProperty[30];
    char namaProperty[30];
    int jumlahProperty;
    double hargaProperty;
    double totalPembayaran;
}Arr[100], compare[100], temp;
void sort_totalPembayaran_descending(){
    int currentIndex=index_counter();
    for(int i=0; i<(currentIndex-1); i++){
        for (int j=0; j<(currentIndex-i-1); j++){
            if (compare[j].totalPembayaran < compare[j+1].totalPembayaran){
                swap(&compare[j], &compare[j+1]);
            }
        }
    }
    system("cls");
    printf("Sorting berdasarkan total pembayaran (Descending)\n");
    print_column();
    print_data(compare);
}
 
     
    