0
NOTE: The first element I am inserting outside of here, this is pro second from now, the while will run until the user type the id of a student -1 q ta in the create function. It’s falling in infinite loop!
void inserir(Aluno *aluno){
while(1){
if(aluno->prox == NULL){
Aluno *aux = aluno;
Aluno *novo = criar();
if(novo->id < 0)
break;
aux->prox = novo;
novo->prox = aux;
}else{
Aluno *aux = aluno->prox;
while(aux->prox != aluno){ // entra e um loop infinito
printf("3\n");
aux = aux->prox;
}
Aluno *novo = criar();
if(novo->id < 0)
break;
aux->prox=novo;
novo->prox=aux;
}
}
}
thank you very much, it helped a lot
– Prog