Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.
struct{
    int value;
    int *pointer;    
}

I want to make doubly linked list using the above structure.

share|improve this question

closed as unclear what you're asking by Bart van Ingen Schenau, MichaelT, gnat, GlenH7, Doc Brown Nov 11 '14 at 12:46

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

    
Unclear what help you need. Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it’s hard to tell what problem you are trying to solve or what aspect of your approach needs to be corrected or explained. See the How to Ask page for help clarifying this question. –  gnat Nov 9 '14 at 12:30

1 Answer 1

You can use a XOR linked list.

Traversing the list will then be:

Node* trailing = 0, current = head;
while(current){
   //visit current->value
   Node* next = trailing ^ current->next;
   trailing = current;
   current = next;
}

You need to have 2 sequential elements to be able to traverse the list. And inserting and removing is more complicated. Most annoyingly debugging them are a pain in the ***.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.