[求助]编译错误的原因!
#include<stdio.h>#include<stdlib.h>
struct Date
{
int num;
struct Date *next;
}
#define LEN sizeof(struct Date)
struct Date *insert(struct Date *head,struct Date *p0);
void print(struct Date *head);
int main()
{
struct Date *newnode;
int number;
struct Date *headpoint;
headpoint=NULL;
printf("输入需要插入的数,输入0结束:\n");
scanf("%d",&number);
while(number!=0)
{
newnode=(struct Date *)malloc(LEN);
if(!newnode)
{
printf("内存不足!\n");
return 0;
}
newnode->num=number;
headpoint=insert(headpoint,newnode);
scanf("%d",&number);
}
printf("插入结束!!!");
print(headpoint);
return 0;
}
struct Date *insert(struct Date *head,struct Date *p0)
{
struct Date *p1;
struct Date *p2;
p1=head;
if(head==NULL)
{
head=p0;
p0->next=NULL;
}
else
{
while((p0->num>p1->num)&&(p1->next!=NULL))
{
p2=p1;
p1=p1->next;
}
if(p0->num<=p1->num)
{
if(p1==head)
{
head=p0;
p0->next=p1;
}
else
{
p2->next=p0;
p0->next=p1;
}
}
else
{
p1->next=p0;
p0->next=NULL;
}
return head;
}
}
void print(struct Date *head)
{
printf("链表中的数据:\n");
if(!head)
{
printf("链表为空!!!\n");
}
while(head)
{
printf("%5d->",head->num);
head=head->next;
}
printf("NULL\n");
}
问题:编译软件说void print(struct Date *head);有误:error C2236: unexpected 'struct' 'Date'