Hey guys! I need some assistance in creating my header node or cell in a double circularly linked list. I have come up with the single linked list header node: Code: list_ptr createHeader (void){ list_ptr L; L = (list_ptr) malloc(sizeof(list)); L->next = NULL; return L; } However, I'm having difficulty in coding the header previous, which in fact would instantly point to the last node in my double circularly linked list. How do I go about adding that code to my createHeader function? Is it as simple as stating the following: Code: L->prev = NULL; Am I missing something? Thanks again! Regards, Jose
It should be assigned when you have the second node in question or you can point to the head node itself whichever is useful to you. I would prefer assigning it to the head node.
Hey shabbir! Thanks for the prompt reply. I am not really understanding your reply. How do we go about implementing that in my createHeader function? Do you meant it will be assigned automatically? Code: L->prev=L; Is that what you mean? Thank you for your time, Jose
For the second node It will not be automatic but you need to be doing that but the second option I was saying is what you have understood.