I have to develop a linked list similar to one I found asked about on this site:
xor linked list
Mine has a twist though.
The function signatures include pointers to pointers for the head and tail, along with the integer number.
Here is my source.
I am only working on the insert method at this time. I am kind of just code pushing for the declarations in that function, no really knowledge on what I should be doing. I am very confused with the **head and **tail variables.
#define SIZERANGE 100
typedef struct node
unsigned long link;
node *head, *tail;
void insert(node **head,node **tail, int n)
node *prev, *cur, *next, *tmp;
node *newnode = malloc(sizeof(node));
head = &cur;
prev = NULL;
while(cur->data < n)
next = (node *)(cur->link ^ (unsigned long)prev);
prev = cur;
cur = next;
newnode->link ^= (unsigned long) prev ^(unsigned long) cur;
prev->link ^= (unsigned long) cur ^ (unsigned long) newnode;
cur->link ^= (unsigned long) prev ^ (unsigned long) newnode;
void delete(node **head, node **tail, int n)
void list(node *head)
int startRange, endRange, n,i;
scanf("%d %d\n", &startRange, &endRange);
for(i=0; i <= SIZERANGE; i++)
insert(&head, &tail, rndm());
Can someone kind of give me a push in the right direction concerning how this function should be operating and the variable declarations?