[求助]我的一个函数在TC2.0下无法通过!
就是那个OrderInsert()通不过,说什么d没有定义什么的!哪位大虾帮帮我!!(错误为:Possible use of 'd' before definition in function OrderInsert()! typedef struct{
int OccurTime;
int NType;
}Event,ElemType;
typedef struct LNode{
ElemType data;
struct LNode *next;
}*Link,*Position;
typedef struct{
Link head,tail;
int len;
}LinkList;
typedef LinkList EventList;
Status MakeNode(Link p,ElemType e)
{
p=(Link)malloc(sizeof(struct LNode));
if(!p) return ERROR;
p->data.OccurTime=e.OccurTime;
p->data.NType=e.NType;
p->next=NULL;
return OK;
}
Status OrderInsert(EventList ev, ElemType a)
{
Link b,c=NULL,d;
if(!MakeNode(d,a)) return ERROR;
for(b=ev.head;a.OccurTime>=b->data.OccurTime||b!=NULL;c=b,b=b->next);
if(b==NULL){
ev.tail.next=d;
ev.tail=d;
if(!ListLength(ev))
ev.head=d;
}
else if(c==NULL){
d->next=ev.head;
ev.head=d;
}
else {
d->next=c->next;
c->next=d;
}
ev.len++;
return OK;
}
[此贴子已经被作者于2006-8-28 18:13:13编辑过]