#include <stdio.h>
#include <stdlib.h>
typedef int ItemValue;
typedef struct DoubleLinkedList
{
ItemValue value;
struct DoubleLinkedList *pre;
struct DoubleLinkedList *next;
} DoubleList, *pDoubleList;
DoubleList *CreateDoubleLinkedList()
{
DoubleList *head = (DoubleList *)malloc(sizeof(DoubleList));
head->pre = NULL;
head->next = NULL;
DoubleList *pTemp;
pTemp = head;
ItemValue iValue;
while (scanf("%d", &iValue) != EOF)
{
DoubleList *p = (DoubleList *)malloc(sizeof(DoubleList));
p->value = iValue;
p->next = pTemp->next;
p->pre = pTemp;
pTemp->next = p;
pTemp = p;
}
return head;
}
void VisitDoubleLinkedList(DoubleList *L)
{
DoubleList *p = L;
while (p->next != NULL)
{
printf("%d ", p->next->value);
p = p->next;
}
}
int main()
{
DoubleList *DL;
DL = CreateDoubleLinkedList();
VisitDoubleLinkedList(DL);
free(DL);
system("pause");
return 0;
}