Well, right here cur could be NULL, so when you hit your first if check, you could be dying there.Code:while((cur != NULL) && (cur->data < newnode->data)) { node *next = (node *)(cur->link ^ (unsigned long)prev); prev = cur; cur = next; } if(cur->data >= newnode->data)
Quzah.