-->
当前位置:首页 > 题库

单选题:已知一结构体类型及变量定义如下:

Luz5年前 (2021-05-10)题库1678
已知一结构体类型及变量定义如下:
```c++
struct node{
int data;
struct node *next;
} *h,*p;
```
现已有头指针h指向的单链表如下图所示,要实现p指向的结点插入在链表头部的语句是:@[D](2)

说明:图中虚线箭头表示插入后改变的指针。

![无标题.bmp](~/3b6a2e88-06c1-41f4-8fb4-93f3863f855b.bmp)

A. p=h; h->next=p;
B. p=h; h=p;
C. p->next=h; h->next=p;
D. p->next=h; h=p;




A.p=h; h->next=p;
B.p=h; h=p;
C.p->next=h; h->next=p;
D.p->next=h; h=p;


答案:D