Linked lists - single or double pointer to the head

前端 未结 3 1807
暖寄归人
暖寄归人 2021-01-16 09:57

We are given a task and a struct of linked list:

typedef struct dlistint_s
{
    int n;
    struct dlistint_s *prev;
    struct dlistint_s *next;
} dlistint_         


        
3条回答
  •  走了就别回头了
    2021-01-16 10:33

    If you use a double pointer, you can pass in the address of the head so your functions can modify the actual pointer. This way you don't need to return the new head.

提交回复
热议问题