Code:
return ((struct jogoJogado *)elem1)->res_final = ((struct jogoJogado *)elem2)->res_final;
This doesn't do what you think it does.
Code:
listas[0] = (struct jogoJogado*)malloc(sizeof(struct jogoJogado));
int i;
int retorno=fread(listas[0], sizeof(struct jogoJogado), 1, f);
for(i=1;retorno==1;i++)
{
listas[i]=(struct jogoJogado*)malloc(sizeof(struct jogoJogado));
retorno= fread(listas[i], sizeof(struct jogoJogado), 1, f);
}
This bit of code will always allocate one more structure than what you read in, and "i" will be one too high. It can also be shortened and simplified (which usually translates to clarity and ease of understanding what it does).
Code:
qsort(listas, 4, sizeof(struct jogoJogado), comparador);
Where did 4 come from?