当前位置:百科知识 > 知到诗歌创作答案

问题描述:

[单选] ‌已知不带头结点的单链表L,下面用函数实现的在第一个元素前面插入值为x的元素结点的算法错误的是()‍
A.void insert(List *L,elemtype x){ ptr p=*L; node d=new node(x); ptr q=&d; q->next=p; L=&q;} B.List * insert(List *L,elemtype x){ ptr p=*L; node d=new node(x); ptr q=&d; q->next=p; L=&q; return L;} C.void insert(List *L,elemtype x){ ptr p=*L; node d=new node(x); ptr q=&d; p->next=q; L=&q;} D.List * insert(List *L,elemtype x){ ptr p=*L; node d=new node(x); ptr q=&d; q->next=p; return &q;}
参考答案:查看
答案解析:
☆收藏

随机题目