为什么不能输出?
#include "stdio.h"#include "stdlib.h"
#define TRUE 1
#define ERROR 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int Status;
typedef int ElemType;
typedef struct DuLNode
{
ElemType data;
struct DuLNode *prior;
struct DuLNode *next;
}DuLNode,*DuLinkList;
void createList_Dul(int n)
{
DuLinkList head;
DuLinkList p;
DuLinkList s;
DuLinkList L;
int num;
int i=0;
L=(DuLinkList)malloc(sizeof(DuLNode));
L->prior=L;
L->next=L;
p=L;
for(i=1;i<=n;i++)
{
printf("input number:\n");
scanf("%d",&num);
s=(DuLinkList)malloc(sizeof(DuLNode));
s->data=num;
s->next=NULL;
s->prior=p;
p=s;
}
}
void print_Dul(int n)//这个函数为什么不能实现输出功能?代码该如何修改?
{
DuLinkList L;
DuLinkList p;
DuLinkList s;
int i=0;
p=L->next;
while(p!=NULL)
{
printf("%d",p->data);
p=p->next;
}
}
int main(int argc, char* argv[])
{
createList_Dul(5);
print_Dul(5);
return 0;
}