I am trying to sort a linked list in an ascending order according to the element of the struct"capacite" . But it doesn't give a result. What is the mistake i am making? Here is my code
typedef struct avion avion;
typedef avion* aliste;
struct avion
{
char code[20];
int capacite;
char etat;
int date;
int nvols;
aliste svt;
};
i have created the list. and following the function that sort it:
void tri(aliste L)
{
aliste i,j,min,tmp;
for (i=L; i->svt != NULL; i=i->svt)
{
min=i;
for (j=i->svt; j != NULL; j=j->svt)
{
if (j->capacite < min->capacite)
min=j;
}
if (min != i)
{
tmp=min;
min=i;
i=tmp;
}
}
}