Doesn't insert and doesn't keep adresses of next and prev node: I'm trying to read input from file; It can read all data corectly and based on every line, creates an Aeronava object. It seems that the insert doesn't work.any suggestions?
void insertFAV_Av(FAVnode*list, Aeronava *av){
FAVnode* nn = (FAVnode*)malloc(sizeof(FAVnode));
//first = list;
nn->infoUtil = (Aeronava*)malloc(sizeof(Aeronava));
nn->infoUtil->idAeronava = (char*)malloc(strlen(av->idAeronava) + 1);
//strcpy(nn->infoUtil->idAeronava, av->idAeronava);
nn->infoUtil = av;
if (first == NULL){
nn->prev = nn->next = nn;
first = nn;
}
else{
list = first;
while (list->next != first){
list = list->next;
}
nn->prev = list;
list->next = nn;
nn->next = first;
}
}
struct Aeronava{
char* idAeronava;
tipA tipAero;
short int nrLocuri;
double greutateMaxima;
};
struct FAVnode{
FAVnode*next;
FAVnode*prev;
Aeronava* infoUtil;
};