t=malloc(sizeof(NODE));
t->lname[i]=ln[i];
t->fname[i]=fn[i];
t->add[i]=ad[i];
t->telno[i]=tn[i];
t->next=NULL;
i++;
if(*h==NULL){
printf("\nCreating record...");
*h=t;
}
else{
p=*h;
if(p->next!=NULL)
{
while(p->next!=NULL){
if(strcmp(p->lname[i],ln[i])>=0){
p->prev->next=t;
t->next=p;
}
p->prev=p;
}
}
else
{
if(strcmp(p->lname[i],ln[i])>=0)
{
p->next=t;
t->prev=p;
t->next=NULL;
}
else
{
p->prev=t;
t->next=p;
}
*h=p;
}
}
could help me with my code? i can't make the 3rd node and when i try to make the 2nd node and print it the 2nd node will replace the data inside my first node.