Hi all,
I am having trouble modifying a linked list. I am writing a function to delete the last node from the linked list, but it gave me incompatible types error.
Here is my struct:
Code:
typedef struct PCB{
    int id;
    struct PCB *next;
    struct PCB *prev;
}PCB_rec, *PCB_p;
Here is my function to delete the last node (given the pointer is pointing at the last node of the list):

Code:
void del_last_node(PCB_p *process_list){
        PCB_p temp = process_list;
        if (temp->prev != NULL){
                temp = temp->prev;
                temp->next->prev = NULL;
                temp->next = NULL;
        }
        else {
                temp = NULL;
        }
        process_list = temp;
}
And here is how I called the function:
Code:
del_last_node(&process_list);
It gives me the following errors:
initialization from incompatible pointer type at line:
PCB_p temp = process_list

assignment from incompatible pointer type at line:
process_list = temp

Can you guys give me some hints at what I did wrong? Thanks in advance.