我不断收到分段错误,但我不知道为什么,我知道我的分段错误在哪里,但不知道如何修复它。
struct node {
int line;
int count;
char* word;
struct node* next;
};
struct node* nodeGetPreviousNode (struct node* head, struct node* node)
{
//return the previous node given the node
while(((head) != NULL) ||((head)->next != node))
{
(head) = (head)->next;
}
return (head);
}