Questions about Linked Lists?

DCLL Push function

DCLL Push function

par amir el halabi,
Nombre de réponses : 3
Avatar GroupEn
What is the difference in DCLL when linking the end of the list to the new node in Push ( true when creating new pointer last  , else false ) ?
I don't get it , i am not changing the *headRef  value so pointer last should be the same but if i use "last"  instead of "(*headRef)->prev" in line 14 the code won't pass the test cases , it gives another output . Where is the problem ? 
failed
accepted
En réponse à amir el halabi

Re: DCLL Push function

par Ahmad AlLakeas,
Avatar GroupEn
I think doctor explained it before the files exercise something about building with tailRef
Use :
newnode->next=*headRef;
newnode->prev=(*headRef)->prev;
newnode->prev->next=newnode:;
newnode->next->prev=newnode;
*headRef=newnode;
This will always work