we have this struct and we must to make a linked list
Expand|Select|Wrap|Line Numbers
- struct node {
- char name[NAMESIZE];
- char phone[PHONESIZE];
- struct node *prevName; // previous node alphabetically
- struct node *prevNumber; // previous node sorted by numbers
- struct node *nextName; // next node alphabetically
- struct node *nextNumber; // next node sorted by numbers
- } ;
1)one with prevName and nextName
2) and one with prevNumber and nextNumber
From these lists i will print the elements alphabetically or sorted by numbers
I believe that i must make ONE list such as:
malloc for the newnode and then just change the pointesr to be sorted
My problem is that i can't do this in one list.I don't know what i need(maybe 2 while loops for the pointers?) and i am confused.Please give any idea?
(if you want i can post the code to add a number in a doubly linked list sorted)