当前位置: 代码迷 >> C语言 >> [求助]编译错误的原因!
  详细解决方案

[求助]编译错误的原因!

热度:292   发布时间:2007-06-13 00:15:14.0
[求助]编译错误的原因!
#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'
搜索更多相关的解决方案: 编译  

----------------解决方案--------------------------------------------------------
其它的没错,只有那里错了!
----------------解决方案--------------------------------------------------------
问题解决!
----------------解决方案--------------------------------------------------------
  相关解决方案