第23689题 单选题
双向链表表头插入新节点,补全空缺处代码

小杨想在双向链表中加入一首新歌曲,将其作为链表的第一首歌曲,则下面横线上应填入的代码为( )。

void insert(dl_node *head, string my_song) {
    p = new dl_node;
    p->song = my_song;
    p->prev = nullptr;
    p->next = head;

    if (head != nullptr) {
        __________________________  // 在此处填入代码
    }
    head = p;
}
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析