#include<stdio.h>
#include<malloc.h>
#define NULL 0
struct st
{
int num;
struct st *next;
};
int n=0;
void creat()
{struct st *head;
struct st *p1,*p2,*p3;
head=NULL;
p3=head;
p1=p2=(struct st *)malloc(sizeof(struct st));
scanf("%c",&p1->num);
while(p1->num!=NULL)
{if(n==0)
{head=p1;
}
else
p2->next=p1;
p2=p1;
p1=(struct st *)malloc(sizeof(struct st));
scanf("%d",&p1->num);
n=n+1;
}
p2->next=NULL;
for(p1=p3;p1->next=!NULL;p1=p1->next)
printf("%d",p1->num); /就是这一段,我明明把头结点给了p1,为什么还是输出不了/
}
void main()
{
creat();
}
链表输出怎么改
最新推荐文章于 2023-12-27 16:28:51 发布