//还有循环单链表,循环双链表及静态链表,考研了解即可
include [HTML_REMOVED]
include [HTML_REMOVED]
typedef int ElemType;
typedef struct DNode
{
ElemType data;
struct DNode prior, next;
} DNode, *DLinkList;
DLinkList HearInsert(DLinkList &Dl)
{
DNode s;
int x;
Dl = (DLinkList)malloc(sizeof(DNode));
Dl->next = NULL;
Dl->prior = NULL;
scanf(“%d”, &x);
while (x != 9999)
{
s = (DLinkList)malloc(sizeof(DNode));
s->data = x;
s->next = Dl->next;
if (Dl->next != NULL)
{
/ code /
Dl->next->prior = s;
}
s->prior = Dl;
Dl->next = s;
scanf(“%d”, &x);
}
return Dl;
}
void PrintDLink(DLinkList Dl)
{
Dl = Dl->next;
while (Dl != NULL)
{
/ code */
printf(“%3d”, Dl->data);
Dl = Dl->next;
}
printf(“\n”);
}
int main()
{
DLinkList Dl;
DLinkList search;
HearInsert(Dl);
PrintDLink(Dl);
return 0;
}