what's wrong with this program, i will sort descending this program
#include <stdio.h>
#include <stdlib.h>
FILE *fp;
typedef struct buku{
int no;
char judul[30];
char pengarang[30];
int jumlah;
}dt_buku;
dt_buku sementara[50],bantu;
int i,j;
void tukar(void);
void viewData(void);
void sortData(void);
int main()
{
viewData();
printf("\n\n");
sortData();
return 0;
}
void tukar()
{
bantu = sementara[i];
sementara[i] = sementara[j];
sementara[j] = bantu;
}
void viewData()
{
if((fp = fopen("databuku.txt","r")) == NULL)
{
printf("File gagal diciptakan");
exit(1);
}
printf("%2s. %30s %30s %s\n\n","No","Judul","Pengarang","Jumlah");
for(i=0;i<10;i++){
fread(&sementara[i], sizeof(sementara[i]),1,fp);
printf("%2d %30s %30s %2d\n",i+1, sementara[i].judul, sementara[i].pengarang, sementara[i].jumlah);
}
fclose(fp);
}
void sortData()
{
for(i=0;i<10;i++){
for(j=0;j<10;j++){
if(sementara[i].jumlah < sementara[j].jumlah){
tukar();}
}
}
viewData();
}