1
That’s what I thought:
Aluno *ordenarNome(Aluno *aluno){
Aluno *aux;
Aluno *aux2 = (Aluno*)malloc(sizeof(Aluno));
Aluno *aux3 = (Aluno*)malloc(sizeof(Aluno));
Aluno *aux4 = (Aluno*)malloc(sizeof(Aluno));
Aluno *aux5 = (Aluno*)malloc(sizeof(Aluno));
*aux = *aluno;
char nome[30];
int id = 0;
int matricula;
int idade;
while(aux != NULL){
*aux2 = *aux->prox;
while(aux2 != NULL){
if(aux2->nome[0] < aux->nome[0]){
*aux3 = *aux2;
id++;
}
aux2=aux2->prox;
}
if(id > 0){
*aux4 = *aux;
*aux = *aux3;
while(aux4 != NULL){
aux->prox=aux4;
aux5 = aux4->prox;
if(aux3->id == aux5->id){
break;
}
aux4=aux4->prox;
}
}
id=0;
aux=aux->prox;
}
aluno = aux;
return aluno;
}
But it is failing (OBS: compiles using gcc on linux and gives that memory error)
Please don’t put tags that have nothing to do with the problem.
– user28595
Prog checks this *aux2 = *aux->Prox; which is possibly putting in the wrong place ;
– Maurício Z.B