So how about you start checking your values before you start trying to use them?Check to see that ->head exits before you start trying to access its members. Never assume a pointer points somewhere valid. It's obvious it doesn't, since your debugger is telling you it doesn't.Code:void insertBeforeFirst(ListRef L, int data){ NodeRef temp= newNode(data); if(L== NULL){ printf("Queue Error: called insertBeforeFirst() on NULL ListRef\n"); exit(1); } if(isEmpty(L)){ L->head= L->tail= temp; } else{ temp->next = L->head; L->head->prev= temp; L->head= temp; } L->length++; }
Quzah.